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
If I run go test ./..., the underscored package (_bar) is skipped. I can run those tests by running go test ./_bar so they're not completely disabled, but ... evidently does not resolve underscored packages.
However the test resolverdoes resolve underscored packages. I think it's OK for underscored packages to appear in the test explorer, since Go does let you build/test those packages, but they should be skipped when running all tests. Though maybe there should be a setting to control whether they're resolved at all. If they are resolved but skipped, that would need to be handled by GoTestRunner.run IIRC. This issue is reproduced by this project.
$ go list ./...
underscore-test/foo
The text was updated successfully, but these errors were encountered:
@hyangah do you have an opinion on whether underscored packages should be completely ignored (excluded by the resolver) or simply skipped if they're not explicitly selected, like benchmarks?
Surprised to learn that go test ./_bar works. I wonder how common this type of
project structure is common.
Files whose names begin with "_" or "." are ignored
according to https://pkg.go.dev/cmd/go#hdr-Test_packages
and many people depend on this to avoid unnecessary scanning.
I am inclined to align with the go's behavior and skip _ or . prefixed
directories. (testdata too).
In my case there was some old code I wanted to continue referencing but not maintaining, so I underscored it. I discovered this issue because another developer used "Run all tests" and a test failed (and apparently the package still builds). I've done this a few other times, but in every case my assumption was that it would be totally ignored given that gopls and go build ignored it.
suzmue
added
NeedsFix
The path to resolution is known, but the work has not been done.
go-test
issues related to go test support (test output, test explorer, ...)
labels
Aug 3, 2023
Given the following project:
If I run
go test ./...
, the underscored package (_bar) is skipped. I can run those tests by runninggo test ./_bar
so they're not completely disabled, but...
evidently does not resolve underscored packages.However the test resolver does resolve underscored packages. I think it's OK for underscored packages to appear in the test explorer, since Go does let you build/test those packages, but they should be skipped when running all tests. Though maybe there should be a setting to control whether they're resolved at all. If they are resolved but skipped, that would need to be handled by
GoTestRunner.run
IIRC. This issue is reproduced by this project.The text was updated successfully, but these errors were encountered: