Description
Go version
This affects Go 1.23.x only. The test passes on Go 1.24.x and at tip.
Output of go env
in your module/workspace:
GOOS='darwin'
GOARCH='arm64'
What did you do?
Looked at the failing builds on the build dashboard, e.g., https://ci.chromium.org/b/8713515151815260705, and tried to run the the test locally on darwin/arm64. It reproduced the failure.
Note that the darwin-arm64-longtest builder where this reproduces was added recently in #73488. The same test passes on darwin-amd64-longtest builders (e.g., https://ci.chromium.org/ui/p/golang/builders/ci/go1.23-darwin-amd64-longtest/b8713515151301513937/test-results?q=cmd%2Fgo.TestScript%2Fbuild_trimpath_cgo).
What did you see happen?
Test fails with:
script_test.go:159: FAIL: testdata/script/build_trimpath_cgo.txt:13: go run ./list-dwarf hello.exe: exit status 1
Full log:
# Go 1.25-ish
$ GOTOOLCHAIN=local go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
[...]
--- PASS: TestScript (0.04s)
--- PASS: TestScript/build_trimpath_cgo (7.40s)
PASS
ok cmd/go 4.394s
$ GOTOOLCHAIN=go1.24.3 go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
[...]
PASS
ok cmd/go 4.572s
$ GOTOOLCHAIN=go1.23.9 go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
=== RUN TestScript
vcs-test.golang.org rerouted to http://127.0.0.1:63038
https://vcs-test.golang.org rerouted to https://127.0.0.1:63039
go test proxy running at GOPROXY=http://127.0.0.1:63040/mod
=== RUN TestScript/build_trimpath_cgo
=== PAUSE TestScript/build_trimpath_cgo
=== CONT TestScript/build_trimpath_cgo
script_test.go:135: 2025-05-29T23:06:13Z
script_test.go:137: $WORK=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657
script_test.go:159:
PATH=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/testbin:/Users/gopher/go/pkg/mod/golang.org/[email protected]/bin:[...]:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:[...]:/Library/Apple/usr/bin:/usr/local/go/bin:/Users/gopher/go/bin:/Users/gopher/bin
HOME=/no-home
CCACHE_DISABLE=1
GOARCH=arm64
TESTGO_GOHOSTARCH=arm64
GOCACHE=/Users/gopher/Library/Caches/go-build
GOCOVERDIR=
GODEBUG=
GOEXE=
GOEXPERIMENT=
GOOS=darwin
TESTGO_GOHOSTOS=darwin
GOPROXY=http://127.0.0.1:63040/mod
GOPRIVATE=
GOROOT=/Users/gopher/go/pkg/mod/golang.org/[email protected]
GOTRACEBACK=system
TESTGO_GOROOT=/Users/gopher/go/pkg/mod/golang.org/[email protected]
TESTGO_EXE=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/testbin/go
TESTGO_VCSTEST_HOST=127.0.0.1:63038
TESTGO_VCSTEST_TLS_HOST=127.0.0.1:63039
TESTGO_VCSTEST_CERT=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/vcstest199468596/cert.pem
TESTGONETWORK=panic
GOSUMDB=localhost.localdev/sumdb+00000c67+AcTrnkbUA+TU4heY3hkjiSES/DSQniBqIeQ/YppAUtK6
GONOPROXY=
GONOSUMDB=
GOVCS=*:all
devnull=/dev/null
goversion=1.23.9
CMDGO_TEST_RUN_MAIN=true
HGRCPATH=
GOTOOLCHAIN=auto
newline=
WORK=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657
TEST_TELEMETRY_DIR=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/telemetry
TMPDIR=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/tmp
GOPATH=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/gopath
PWD=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/gopath/src
# This test builds a cgo binary and verifies the source directory path
# does not appear in the binary, either literally or in compressed DWARF.
# TODO(golang.org/issue/36072): ideally we should build a binary from identical
# sources in different directories and verify the binary and all intermediate
# files are identical. (0.000s)
> [short] skip
[condition not met]
> [!cgo] skip
[condition not met]
# Check that the source path appears when -trimpath is not used. (1.242s)
> go build -o hello.exe .
> grep -q gopath[/\\]src hello.exe
> go run ./list-dwarf hello.exe
[stderr]
2025/05/29 19:06:14 decoding dwarf section info at offset 0x5f2af: DW_FORM_strx with no .debug_str_offsets section
exit status 1
script_test.go:159: FAIL: testdata/script/build_trimpath_cgo.txt:13: go run ./list-dwarf hello.exe: exit status 1
--- FAIL: TestScript (0.04s)
--- FAIL: TestScript/build_trimpath_cgo (1.25s)
FAIL
FAIL cmd/go 1.795s
FAIL
What did you expect to see?
Passing test on Go 1.23 release branch, or skipped test if the failure is understood and it's better to skip.
The same test was also failing for @matloob in #70669 and was fixed in Go 1.24, but this appears to be a different issue in the same test.