Go version
go version go1.23.0 linux/amd64
Output of go env
in your module/workspace:
GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org'
GOROOT='/home/user/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/user/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/user/src/project/backend/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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build356147905=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Run
go build
Can't trace this right now, and give you a reproducible source code, because I'm not sure what's the root case. I'll keep looking.
What did you see happen?
panic: runtime error: index out of range [1232602353] with length 116
goroutine 1 [running]:
cmd/link/internal/loader.(*Loader).resolve(0xc000778008?, 0x15765d0003eef9?, {0x4?, 0x0?})
cmd/link/internal/loader/loader.go:647 +0x178
cmd/link/internal/loader.Aux.Sym(...)
cmd/link/internal/loader/loader.go:73
cmd/link/internal/ld.(*deadcodePass).flood(0xc0000fd688)
cmd/link/internal/ld/deadcode.go:280 +0xed4
cmd/link/internal/ld.deadcode(0xc0001a6200)
cmd/link/internal/ld/deadcode.go:440 +0x7d
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0xc000012521, 0x1, 0x1}, ...})
cmd/link/internal/ld/main.go:360 +0x1318
main.main()
cmd/link/main.go:72 +0xddb
What did you expect to see?
go build without errors
Comment From: gabyhelp
Related Issues and Documentation
- cmd/link: index out of range panic when linking program #47432 (closed)
- cmd/link: panic during deadcode pass #17729 (closed)
- cmd/link: index out of range when compiling plugin #17140 (closed)
- cmd/compile: panic during generic deadcode #56777 (closed)
- panic: runtime error: index out of range。 cmd/link/internal/ld.decodetypeKind(...) #51935 (closed)
- cmd/link: panic with `index out of range` in `cmd/link/internal/loader.(*Loader).resolve` #62355
- cmd/go: go build crashes with "index out of range" #10391 (closed)
- cmd/link: 'index out of range' when build with buildmode=plugin #17443 (closed)
- cmd/go: panic when building a `main` package in GOPATH mode when a go.work file exists #58767 (closed)
- cmd/link: runtime error: index out of range #11186 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: ianlancetaylor
Has this happened more than once?
I think we're going to need a way to reproduce the problem.
Comment From: krhubert
Has this happened more than once?
Yes
I think we're going to need a way to reproduce the problem.
It's gonna be extremely hard to me to reproduce it.
This happened when I worked on my project and switched between branches.
On the main
branch, go build
returned without errors, but on other branch with a single commit added,
go build panicked. Today I can't reproduce this case, but yesterday it was like that until a restarted WSL.
I'm not sure if/how I can help more. If there's not enough data to reproduce it I can close this issue.
Comment From: cherrymui
Could you try clear the build cache (go clean -cache
) and see if you can still reproduce?
It could be some file corruption in the build cache, or when you switched branch, there was actually some collision in the build cache.
Comment From: gopherbot
Timed out in state WaitingForInfo. Closing.
(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)