nogo incorrectly flags strict dependency error
Versions
- rules_go HEAD, currently
59235b4a - gazelle HEAD, currently
2b326f81 - bazel 7.2.1
Issue
Was working on a gazelle patch for something unrelated, pulled in the latest sources, and noticed that bazel test //... on my repo now has build errors.
nogo: missing strict dependencies:
internal/util/myutil/myutil_test.go: import of "my.module/util/myutil"
I asked git bisect, it said 29d4e5dbcfa702c479311f0bb4a929a236666a46 is the first bad commit: #3995
It looks like nogo is no longer happy with importing a module's own importpath. Since this is a supported pattern in Go, I believe this to be a regression.
Hey Tom, just to double check on this, what's the package name of myutil_test.go?
Is it package myutil or package myutil_test or something else?
It's indeed package myutil_test
Good point, and I hadn't noticed that earlier. That said, the tests do have embed = [":myutil"]. Does that make this a Gazelle issue, or should rules_go pick up the embed?
@TvdW Could you test the fix at https://github.com/bazelbuild/rules_go/pull/4075?
Tested, and all tests pass now! 😃