eandre opened this issue
Mar 12, 2021
· 2 comments
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.
I ran cd foo && go test -overlay=overlay.json . and expected the tests to pass.
What did you expect to see?
$ go test -overlay=overlay.json .
ok test.pkg/foo 0.123s
What did you see instead?
$ go test -overlay=overlay.json .
# test.pkg/foo
vet: open bar.go: no such file or directory
FAIL test.pkg/foo [build failed]
FAIL
exit status 2
The issue is because the overlay is added to GoTestFiles but go vet does not support (or receive information about) overlays, so it tries to read the overlaid file directly from the filesystem where it does not exist.
The text was updated successfully, but these errors were encountered:
Hi, alldocs.go says this: // -overlay file // read a JSON config file that provides an overlay for build operations. // The file is a JSON struct with a single field, named 'Replace', that // maps each disk file path (a string) to its backing file path, so that // a build will run as if the disk file path exists with the contents // given by the backing file paths, or as if the disk file path does not // exist if its backing file path is empty. Support for the -overlay flag // has some limitations: importantly, cgo files included from outside the // include path must be in the same directory as the Go package they are // included from, and **overlays will not appear when binaries and tests are // run through go run and go test** respectively.
Is the above description saying that this is not an issue? I am new, so I could be getting it wrong
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.
6 participants
You can’t perform that action at this time.
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.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Consider the following txtar:
I ran
cd foo && go test -overlay=overlay.json .
and expected the tests to pass.What did you expect to see?
What did you see instead?
The issue is because the overlay is added to
GoTestFiles
butgo vet
does not support (or receive information about) overlays, so it tries to read the overlaid file directly from the filesystem where it does not exist.The text was updated successfully, but these errors were encountered: