-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsFixThe 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
Go version
go version devel go1.23-e44fa1c1a9 2024-06-18 15:33:06 +0000 linux/amd64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT='cacheprog'
GOFLAGS='-trimpath "-ldflags=-s -w"'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
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'
GOTMPDIR=''
GOTOOLCHAIN='path'
GOTOOLDIR='/home/user/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-e44fa1c1a9 2024-06-18 15:33:06 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/home/user/tmp/testrepo0652/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 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1549253000=/tmp/go-build -gno-record-gcc-switches'
What did you do?
for a main_test.go
(note: should be run without the main.go
file below as it can affect the debug settings):
//go:debug panicnil=1
package main_test
import (
"runtime/debug"
"testing"
)
func TestFoo(t *testing.T) {
defer func() {
t.Fatal(recover())
}()
t.Log(debug.ReadBuildInfo())
panic(nil)
}
running it:
=== RUN TestFoo
main_test.go:14: go devel go1.23-e44fa1c1a9 2024-06-18 15:33:06 +0000 X:cacheprog
path go.seankhliao.com/testrepo0652
mod go.seankhliao.com/testrepo0652 (devel)
build -buildmode=exe
build -compiler=gc
build -trimpath=true
build DefaultGODEBUG=asynctimerchan=1,gotypesalias=0,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
build CGO_ENABLED=0
build GOARCH=amd64
build GOEXPERIMENT=cacheprog
build GOOS=linux
build GOAMD64=v3
true
main_test.go:11: <nil>
--- FAIL: TestFoo (0.00s)
FAIL
FAIL go.seankhliao.com/testrepo0652 0.001s
FAIL
vs
a main.go
:
//go:debug panicnil=1
package main
import (
"fmt"
"runtime/debug"
)
func main() {
defer func() {
fmt.Println(recover())
}()
fmt.Println(debug.ReadBuildInfo())
panic(nil)
}
running it:
go devel go1.23-e44fa1c1a9 2024-06-18 15:33:06 +0000 X:cacheprog
path go.seankhliao.com/testrepo0652
mod go.seankhliao.com/testrepo0652 (devel)
build -buildmode=exe
build -compiler=gc
build -trimpath=true
build DefaultGODEBUG=asynctimerchan=1,gotypesalias=0,panicnil=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
build CGO_ENABLED=0
build GOARCH=amd64
build GOEXPERIMENT=cacheprog
build GOOS=linux
build GOAMD64=v3
true
<nil>
What did you see happen?
The test binary did not record a DefaultGODEBUG=panicnil=1
, while the setting was clearly in effect (recover nil).
What did you expect to see?
The setting recorded as part of DefaultGODEBUG
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsFixThe 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.