Go version

go version go1.22.4 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/tmp/.gocache'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY='<redacted>'
GONOSUMDB='<redacted>'
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE='<redacted>'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS='<redacted>'
GOVERSION='go1.22.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
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 -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4162348479=/tmp/go-build -gno-record-gcc-switches'

What did you do?

First I pre-compiled the standard library with -trimpath and -covermode.

go build -trimpath -covermode=atomic std

Then I asked whether the net package was stale.

go list -f '{{.Stale}} {{.StaleReason}}' -trimpath -covermode=atomic net

What did you see happen?

true build ID mismatch

What did you expect to see?

false

Note that it works as expected without -covermode.

Comment From: gabyhelp

Related Issues

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

Comment From: thanm

Thanks for the report. I will take a look later this week.

Comment From: thanm

Hi @rittneje , it appears that this problem is already fixed on tip, and will be present in 1.23. The fix CL is https://go-review.googlesource.com/c/go/+/560236. It also looks as though that fix is going to be back-ported to 1.22, so in theory if you update to Go 1.22.6 when it rolls out in August, that should take care of it. Thanks.