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
Does this issue reproduce with the latest release?
Yes, I think go1.16.6 is the latest release now.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=$HOME\AppData\Local\go-build
set GOENV=$HOME\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=$HOME\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=$HOME\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=$HOME\scoop\apps\go\current
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=$HOME\scoop\apps\go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.6
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=\path\to\my\go\project\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -fmessage-length=0 -fdebug-prefix-map=$HOME\AppData\Local\Temp\go-build3183732203=/tmp/go-build -gno-record-gcc-switches
What did you do?
I'm testing my go code with some external files as deps.
So, then os.Open("./testdata/big_file.bin") should open $PWD/testdata/big_file.bin, not pkg/testdata/big_file.bin
What did you expect to see?
go tests are cached successfully with the real files opened, not the arguments.
What did you see instead?
$ go test ./pkg/...ok some/pkg (cached)
$ go test ./pkg/...ok some/pkg (cached)
$ touch ./pkg/testdata/big_file.bintouch: cannot touch './pkg/testdata/big_file.bin': No such file or directory
$ mkdir ./pkg/testdata
$ touch ./pkg/testdata/big_file.bin
$ go test ./pkg/...ok some/pkg 0.100s
$ head -c 500 /dev/urandom > testdata/big_file.bin
$ go test ./pkg/...ok some/pkg (cached)
The text was updated successfully, but these errors were encountered:
trim21
changed the title
go test cache check wrong file when testing if user do os.Chdir
go test cache check wrong opened file when testing if user do os.ChdirJul 20, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, I think go1.16.6 is the latest release now.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm testing my go code with some external files as deps.
and there is an underscore importing doing this:
this changes the CWD to PWD, which is the root of my project directory.
So, then
os.Open("./testdata/big_file.bin")
should open$PWD/testdata/big_file.bin
, notpkg/testdata/big_file.bin
What did you expect to see?
go tests are cached successfully with the real files opened, not the arguments.
What did you see instead?
The text was updated successfully, but these errors were encountered: