-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
ProposalToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.
Milestone
Description
Go version
go version go1.26-devel_3f94f3d4b2 2025-11-28 15:26:25 -0800 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV=''
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build366711227=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/user/tmp/testrepo1338/go.mod'
GOMODCACHE='/home/user/.data/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/.data/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/user/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/user/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26-devel_3f94f3d4b2 2025-11-28 15:26:25 -0800'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
try to run the reproducer in #15758
package main
import (
"testing"
"time"
)
func TestFoo(t *testing.T) {
go func() {
t.Fatal("fatal") // Called from outside the Test function
}()
time.Sleep(1 * time.Second)
}What did you see happen?
$ go test
--- FAIL: TestFoo (1.00s)
main_test.go:10: fatal
FAIL
exit status 1
FAIL go.seankhliao.com/testrepo1338 1.003s
$ go vet
main_test.go:10:3: call to (*testing.T).Fatal from a non-test goroutineWhat did you expect to see?
The vet check to be enabled by default:
$ go test -vet=all
# go.seankhliao.com/testrepo1338
# [go.seankhliao.com/testrepo1338]
./main_test.go:10:3: call to (*testing.T).Fatal from a non-test goroutine
FAIL go.seankhliao.com/testrepo1338 [build failed]The analysis is golang.org/x/tools/go/analysis/passes/testinggoroutine, I don't know of any false positives that would prevent its inclusion by default.
Metadata
Metadata
Assignees
Labels
ProposalToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.
Type
Projects
Status
No status