You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest releases of all the above?
This is a question, not a bug.
What operating system and processor architecture are you using?
Linux, amd64
Question
I'm in the process of converting some packages to bazel. I've done the following in a few packages and I'm not sure the best way -- or if possible at all -- going forward.
What I can't get to work however are the the other packages which depend on foo and use the methods in foo_testutil.go in their own unit tests. Prior to bazel I just ran go test -tags=testing globally so any bar.go which imported foo didn't see the test-only methods and any bar_test.go which imported foo magically did see the test-only methods.
I've tried a few combinations of playing with importpath, separate instances of the go_library() for testing vs prod, embed, etc. I like this setup because it keeps Foo simple for its main production use while also adding a few handy features for testing (e.g., for modifying private fields).
The text was updated successfully, but these errors were encountered:
What version of rules_go are you using?
0.48.0
What version of gazelle are you using?
0.37.0
What version of Bazel are you using?
7.2.0
Does this issue reproduce with the latest releases of all the above?
This is a question, not a bug.
What operating system and processor architecture are you using?
Linux, amd64
Question
I'm in the process of converting some packages to bazel. I've done the following in a few packages and I'm not sure the best way -- or if possible at all -- going forward.
I can build the above with
go build
and test withgo test -tags=testing
. I can make this work within thefoo
package:What I can't get to work however are the the other packages which depend on
foo
and use the methods infoo_testutil.go
in their own unit tests. Prior to bazel I just rango test -tags=testing
globally so anybar.go
which importedfoo
didn't see the test-only methods and anybar_test.go
which importedfoo
magically did see the test-only methods.I've tried a few combinations of playing with
importpath
, separate instances of thego_library()
for testing vs prod,embed
, etc. I like this setup because it keepsFoo
simple for its main production use while also adding a few handy features for testing (e.g., for modifying private fields).The text was updated successfully, but these errors were encountered: