Skip to content

runtime/debug: ReadBuildInfo gives incomplete answer in a test binary #68045

@rittneje

Description

@rittneje

Go version

go version go1.22.4 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/tmp/.gocache'
GOENV='/Users/rittneje/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/rittneje/go/pkg/mod'
GONOPROXY='<redacted>'
GONOSUMDB='<redacted>'
GOOS='darwin'
GOPATH='/Users/rittneje/go'
GOPRIVATE='git.intra.lutron.com'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/rittneje/go1.22.4'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/Users/rittneje/go1.22.4/pkg/tool/darwin_amd64'
GOVCS='<redacted>'
GOVERSION='go1.22.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD=''
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/kf/kr7_s3xx0l12zbj3jrn082hmzy5gvy/T/go-build3773258374=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

//go:debug tlsrsakex=1

package foo

import (
	"runtime/debug"
	"testing"
)

func TestFoo(t *testing.T) {
	t.Fatal(debug.ReadBuildInfo())
}

What did you see happen?

go go1.22.4
true

What did you expect to see?

I expected it to report DefaultGODEBUG tlsrsakex=1.

Not sure if this is entirely a duplicate of #33976. In that case, it was reported that debug.ReadBuildInfo() returned false, which is not the case here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions