-
Notifications
You must be signed in to change notification settings - Fork 13
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
Finding original package path in directory with _test
package may fails
#33
Comments
@rillig Hello. Thank you for developing this useful tool 🙇♂️ I'd like to contribute gobco and create PR on this issue to resolve it sooner. Is it good for you? and could you tell me some points of caution on contributing this repo if there is it? |
Hello @1st-vil, you found pretty nice use cases, and you explanation is easy to follow. If you have an idea on how to reliably determine the import path of the current package, I'm welcoming a pull request of yours. My idea would be to search for a There are no points of caution, just go ahead. :) |
Hi @rillig. I created a PR on this issue. So I'd like you to review it 🙇♂️ |
@rillig If we merge the PR, I'd like you to publish next release including it after fix. It's because I'd like to use this in fixed version that is ensured not to change. Is it ok? |
@rillig Hello. I'd appreciate it if you could see my PR 🙇 |
@1st-vil Sorry that it took me so long to reply. Thank you for the PR showing that the module can be found. Right now, gobco does not have any external dependencies, and I'd like to keep this property. For just finding the module path, there is no need to verify the hashes, so I'd like to omit these dependencies. Another point I don't understand is why the PR adds dependencies for 5 different versions of |
@rillig Sorry that it took me so long to reply too... I'm also not sure about Could you check my changes again? |
@rillig Hi. Could you see my PR again 🙇 |
Overview
In a directory with multiple package (Maybe they are
something
andsomething_test
), it tries to find the package's path ofsomething
. It is performed by looking for its direct importimport "github.com/org/repo/something"
in the directory. here: https://github.com/rillig/gobco/blob/master/instrumenter.go#L623-L643Maybe it expects there is such import in a file with
something_test
package. But, in some cases like it uses another package as helper, the import may not be in the directory. So there are need to provide secure way to determine the package's path.Example
it can't find the path
something/something.go
something/something_test.go
helper/helper.go
For above files, error like below occurred.
It find incorrect path with same package name
interface/something/something.go
something/factory.go
something/something.go
something/something_test.go
helper/helper.go
For above files, error like below occurred.
The text was updated successfully, but these errors were encountered: