We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
$ go version go version go1.16 darwin/arm64
Yes
go env
$ go env GO111MODULE="on" GOARCH="arm64" GOBIN="" GOCACHE="/Users/eandre/Library/Caches/go-build" GOENV="/Users/eandre/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/eandre/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/eandre" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/homebrew/Cellar/go/1.16/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/Cellar/go/1.16/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.16" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hc/w9bwjfwd69dd6_6thw6xqmkw0000gn/T/go-build1638807139=/tmp/go-build -gno-record-gcc-switches -fno-common"
Consider this txtar:
-- go.mod -- module test.pkg -- foo/foo_test.go -- package foo import "testing" func TestFoo(t *testing.T) { } -- tmp/bar_test.go -- package foo import "testing" func TestBar(t *testing.T) { t.Fatal("dummy failure") } -- foo/overlay.json -- {"Replace": {"bar_test.go": "../tmp/bar_test.go"}}
Running go test -overlay=overlay.json in the foo folder should result in TestBar running.
go test -overlay=overlay.json
foo
TestBar
cd foo go test -overlay=overlay.json . --- FAIL: TestBar (0.00s) bar_test.go:5: dummy failure FAIL FAIL test.app 0.138s FAIL
# test.pkg open /Users/eandre/tmp/foo/bar_test.go: no such file or directory FAIL test.app [setup failed] FAIL
The issue is because https://github.com/golang/go/blob/master/src/cmd/go/internal/load/test.go#L579 implicitly reads from the filesystem instead of using the overlay file data (due to src == nil).
src == nil
The text was updated successfully, but these errors were encountered:
Making this change fixes the issue for me: https://gist.github.com/eandre/45f5a554faff3b23f6f5d92f794a222b
Sorry, something went wrong.
cc @matloob
@eandre Your change looks reasonable. Do you want to contribute it? If not I can make a change myself.
@matloob great! Either way, up to you. I can get around to doing it sometime next week.
Go for it! I look forward to your CL!
Change https://golang.org/cl/305071 mentions this issue: cmd/go/internal/load/test: parse overlay files for test functions
cmd/go/internal/load/test: parse overlay files for test functions
46fa8af
No branches or pull requests
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 this txtar:
Running
go test -overlay=overlay.json
in thefoo
folder should result inTestBar
running.What did you expect to see?
What did you see instead?
The issue is because https://github.com/golang/go/blob/master/src/cmd/go/internal/load/test.go#L579 implicitly reads from the filesystem instead of using the overlay file data (due to
src == nil
).The text was updated successfully, but these errors were encountered: