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

cannot find package "foo" #44

Closed
komuw opened this issue Sep 30, 2017 · 8 comments
Closed

cannot find package "foo" #44

komuw opened this issue Sep 30, 2017 · 8 comments

Comments

@komuw
Copy link

komuw commented Sep 30, 2017

I'm trying to use go-pry to debug this golang project-> https://github.com/komuw/meli
But go-pry is panicking with a weird error, reproduced below:

go-pry run *.go

panic: cannot find package "foo" in any of:
	/home/komu/go/src/github.com/komuw/meli/vendor/foo (vendor tree)
	/usr/local/go/src/foo (from $GOROOT)
	/home/komu/go/src/foo (from $GOPATH)

goroutine 1 [running]:
main.InjectPry(0xc420214c00, 0x60, 0x6c8703, 0x3, 0x1, 0xc42042f6d8)
	/home/komu/go/src/github.com/d4l3k/go-pry/main.go:65 +0x14c0
main.main.func4(0xc423200740, 0x38, 0x80cde0, 0xc420231930, 0x0, 0x0, 0x0, 0x0)
	/home/komu/go/src/github.com/d4l3k/go-pry/main.go:252 +0x140
path/filepath.walk(0xc423200740, 0x38, 0x80cde0, 0xc420231930, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:356 +0x81
path/filepath.walk(0xc4233a2ea0, 0x30, 0x80cde0, 0xc420231860, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0xc421eb60f0, 0x26, 0x80cde0, 0xc4221a4c30, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0xc422661e00, 0x1e, 0x80cde0, 0xc4221a4750, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0xc422661da0, 0x17, 0x80cde0, 0xc4221a4680, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0xc4205932a0, 0x11, 0x80cde0, 0xc420426dd0, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0xc420216288, 0x6, 0x80cde0, 0xc420426d00, 0xc4200ea030, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.walk(0x6c8554, 0x1, 0x80cde0, 0xc4200ec0d0, 0xc4200ea030, 0x0, 0x30)
	/usr/local/go/src/path/filepath/path.go:381 +0x39a
path/filepath.Walk(0x6c8554, 0x1, 0xc4200ea030, 0x2, 0x3)
	/usr/local/go/src/path/filepath/path.go:403 +0x11d
main.main()
	/home/komu/go/src/github.com/d4l3k/go-pry/main.go:243 +0x53e

I'm using dep(https://github.com/golang/dep) as my dependency management tool

@d4l3k
Copy link
Owner

d4l3k commented Sep 30, 2017

When you say cannot find package "foo", is the package name literally foo? Or is that just a placeholder?

That looks like an issue with how go-pry looks for pry.Pry() statements. It doesn't follow dependencies, just parses all go files recursively. With lots of vendor packages, that runs into issues if there's invalid go code.

@komuw
Copy link
Author

komuw commented Oct 1, 2017 via email

@d4l3k
Copy link
Owner

d4l3k commented Oct 1, 2017

You import docker which gets added to the vendor folder and docker is importing foo. It's probably from test code that would normally never run. I think the fix is to add a check to go-pry to not explore the vendor folder.

@komuw
Copy link
Author

komuw commented Oct 4, 2017

merging #45 was probably a good move.

However, it now means that you cant use go-pry in a project where you are depending on dependencies that are in your vendor directory.

so I guess it is a tradeoff

@d4l3k
Copy link
Owner

d4l3k commented Oct 5, 2017

Like, you can't insert pry.Pry() statements in the vendored dependencies? Yeah, hmm... That's kind of the same issue as #19.

@komuw
Copy link
Author

komuw commented Oct 5, 2017

no, I meant you cant insert pry.Pry() statements in your main package if that package main depends on dependencies in your vendor directory

@d4l3k
Copy link
Owner

d4l3k commented Oct 5, 2017

I just tested it and it seems to work just fine. That change just makes it so it doesn't look for pry.Pry() statements in the vendor folder. You can still import vendored dependencies.

@komuw
Copy link
Author

komuw commented Oct 5, 2017

ok, cool. my bad

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