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.17.1 darwin/arm64
Yes. It's the same on 1.17.3
go env
$ go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/emmanuelbriney/Library/Caches/go-build" GOENV="/Users/emmanuelbriney/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/emmanuelbriney/go/pkg/mod" GONOPROXY="github.com/docker,github.com/<...>" GONOSUMDB="github.com/docker,github.com/<...>" GOOS="darwin" GOPATH="/Users/emmanuelbriney/go" GOPRIVATE="github.com/docker,github.com/<...>" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.17.1" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/emmanuelbriney/prog/gotestbug/go.mod" 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/09/qs9jt6q90j188bgbjb6ls36w0000gn/T/go-build1058730670=/tmp/go-build -gno-record-gcc-switches -fno-common"
This simple test file illustrates it
package main import ( "fmt" "testing" ) func TestWithFmt(t *testing.T) { fmt.Print("it fails") } func TestWithoutFmt(t *testing.T) { }
When I use json output there is a missing event
go test -json {"Time":"2021-11-17T11:57:51.123274+01:00","Action":"run","Package":"gotestbug","Test":"TestWithFmt"} {"Time":"2021-11-17T11:57:51.123416+01:00","Action":"output","Package":"gotestbug","Test":"TestWithFmt","Output":"=== RUN TestWithFmt\n"} {"Time":"2021-11-17T11:57:51.123423+01:00","Action":"output","Package":"gotestbug","Test":"TestWithFmt","Output":"it fails--- PASS: TestWithFmt (0.00s)\n"} {"Time":"2021-11-17T11:57:51.123427+01:00","Action":"run","Package":"gotestbug","Test":"TestWithoutFmt"} {"Time":"2021-11-17T11:57:51.123429+01:00","Action":"output","Package":"gotestbug","Test":"TestWithoutFmt","Output":"=== RUN TestWithoutFmt\n"} {"Time":"2021-11-17T11:57:51.123435+01:00","Action":"output","Package":"gotestbug","Test":"TestWithoutFmt","Output":"--- PASS: TestWithoutFmt (0.00s)\n"} {"Time":"2021-11-17T11:57:51.123437+01:00","Action":"pass","Package":"gotestbug","Test":"TestWithoutFmt","Elapsed":0} {"Time":"2021-11-17T11:57:51.123441+01:00","Action":"output","Package":"gotestbug","Output":"PASS\n"} {"Time":"2021-11-17T11:57:51.123471+01:00","Action":"output","Package":"gotestbug","Output":"ok \tgotestbug\t0.003s\n"} {"Time":"2021-11-17T11:57:51.123474+01:00","Action":"pass","Package":"gotestbug","Elapsed":0.003}
It's problematic because we can't state if the test passed or not. Some tools like gotestsum considers it as failure because of this missing event.
I should receive this event
{"Time":"2021-11-17T11:57:51.123437+01:00","Action":"pass","Package":"gotestbug","Test":"TestWithFmt","Elapsed":0}
It's not emitted because I've added an fmt.Print
The text was updated successfully, but these errors were encountered:
Duplicate of #26325
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. It's the same on 1.17.3
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This simple test file illustrates it
When I use json output there is a missing event
It's problematic because we can't state if the test passed or not.
Some tools like gotestsum considers it as failure because of this missing event.
What did you expect to see?
I should receive this event
What did you see instead?
It's not emitted because I've added an fmt.Print
The text was updated successfully, but these errors were encountered: