-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.16 darwin/arm64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ 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"
What did you do?
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.
What did you expect to see?
cd foo
go test -overlay=overlay.json .
--- FAIL: TestBar (0.00s)
bar_test.go:5: dummy failure
FAIL
FAIL test.app 0.138s
FAIL
What did you see instead?
# 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).
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.