golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.08k stars 17.68k forks source link

cmd/go: using both -v and -json with go test has unintended effects #70384

Open firelizzard18 opened 3 hours ago

firelizzard18 commented 3 hours ago

Go version

go version go1.23.1 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/firelizzard/.cache/go-build'
GOENV='/home/firelizzard/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/firelizzard/go/pkg/mod'
GOOS='linux'
GOPATH='/home/firelizzard/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/firelizzard/sdk/go1.23.1'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/firelizzard/sdk/go1.23.1/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/firelizzard/.config/go/telemetry'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/firelizzard/src/yaegi/go-script/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4165056435=/tmp/go-build -gno-record-gcc-switches'

What did you do?

go test -v -json -run=- -bench=^BenchmarkSimple$ ./pkg/vm in the root of https://gitlab.com/firelizzard/go-script

What did you see happen?

Nothing but output events for the benchmark

What did you expect to see?

An "Action":"run" event for the benchmark

gabyhelp commented 3 hours ago

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

firelizzard18 commented 3 hours ago

This is probably related to #61767 and CL 443596. It appears that the presence of -v results in the binary not being called with -test.v=test2json, preventing CL 443596's fix from working.