[Go] Delete existing go install before extracting new version
We're running into some errors in our codespace and it seems to be related to the mcr.microsoft.com/devcontainers/go image being on go 1.22.6 and the ghcr.io/devcontainers/features/go:1 feature being on go 1.23.0.
go install github.com/golangci/golangci-lint/cmd/[email protected]
# runtime
/usr/local/go/src/runtime/mbitmap_noallocheaders.go:53:2: mallocHeaderSize redeclared in this block
/usr/local/go/src/runtime/mbitmap.go:71:2: other declaration of mallocHeaderSize
/usr/local/go/src/runtime/mbitmap_noallocheaders.go:54:2: minSizeForMallocHeader redeclared in this block
/usr/local/go/src/runtime/mbitmap.go:101:2: other declaration of minSizeForMallocHeader
/usr/local/go/src/runtime/mbitmap_noallocheaders.go:60:6: heapBitsInSpan redeclared in this block
/usr/local/go/src/runtime/mbitmap.go:112:6: other declaration of heapBitsInSpan
....
Reinstalling go fixes it.
wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
https://go.dev/doc/install
Do not untar the archive into an existing /usr/local/go tree. This is known to produce broken Go installations.
I didn't verify the exact pair of files that is causing the problem, but it appears that Go 1.23.0 renamed or deleted or added a file that conflicts with a file in Go 1.22.6 that doesn't get overwritten by the extraction of the new version.
@samruddhikhandale can you take another look when you have a minute?
@Kaniska244 @eljog mind taking a look at this PR?