Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic when package/file exists in GOPATH root #3

Closed
mastercactapus opened this issue Jan 5, 2018 · 1 comment
Closed

panic when package/file exists in GOPATH root #3

mastercactapus opened this issue Jan 5, 2018 · 1 comment

Comments

@mastercactapus
Copy link

mastercactapus commented Jan 5, 2018

Running gopkgs while a file having a non-main package is in the root of GOPATH, it panics.

Steps To Reproduce

  1. Create foo.go with the line package foo at $GOPATH/src/foo.go
  2. Run gopkgs

Observed Behavior

It panics.

Expected Behavior

No panic, the file(s) should be ignored as invalid.

Example Output

$ echo "package foo" >$GOPATH/src/foo.go
$ gopkgs
panic: runtime error: slice bounds out of range

goroutine 96 [running]:
github.com/uudashr/gopkgs.Packages.func1(0xc4202e1ec0, 0x20, 0x6b3440, 0xc42035b450, 0x0, 0x0, 0x0, 0x0)
	/home/nathan/projects/src/github.com/uudashr/gopkgs/gopkgs.go:68 +0x5a6
github.com/MichaelTJones/walk.(*WalkState).visitFile(0xc420251310, 0xc42000a920, 0x19, 0x6b3440, 0xc42035b450)
	/home/nathan/projects/src/github.com/MichaelTJones/walk/walk.go:125 +0x467
github.com/MichaelTJones/walk.(*WalkState).visitChannel(0xc420251310)
	/home/nathan/projects/src/github.com/MichaelTJones/walk/walk.go:71 +0xd9
created by github.com/MichaelTJones/walk.Walk
	/home/nathan/projects/src/github.com/MichaelTJones/walk/walk.go:157 +0x1f1

Ran into this after some digging into why unimported autocomplete wasn't working in vscode for me.

@uudashr
Copy link
Owner

uudashr commented Jan 5, 2018

Thanks for the report.. fixed. You need to update the gopkgs

@uudashr uudashr closed this as completed Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants