cmd/go: go list fails with "no non-test Go files" but succeeds upon re-running #56018
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
While working on an unrelated gopls bug, I stumbled into a scenario where
go list
fails non-deterministically depending on whether GOCACHE is populated.Test setup: (from x/tools/gopls/internal/regtest/misc.TestImportTestVariant)
Notably
client/test/role.go
importsmod.com/client
, which has no go files (an unintentional bug in the test setup). However, I observed that the entire workspace load fails for gopls in this scenario, due to the following go command bug:The first time the go command runs, it returns a non-zero exit code with the "no non-test Go files" error printed to stderr. The second time, it succeeds with no error.
I see no reason for the error upon the first invocation, but even so the error should of course not depend on the state of the cache.
In my testing, this bug exists at least back to Go 1.12, so it's hard to make an argument for urgency (other than the fact that it just cost me two hours of debugging! :) )
CC @bcmills @adonovan
The text was updated successfully, but these errors were encountered: