Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go] Delete existing go install before extracting new version #1099

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mitesch
Copy link

@mitesch mitesch commented Aug 19, 2024

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.

@mitesch mitesch requested a review from a team as a code owner August 19, 2024 17:40
src/go/install.sh Outdated Show resolved Hide resolved
src/go/install.sh Show resolved Hide resolved
src/go/install.sh Show resolved Hide resolved
@mitesch mitesch changed the title Delete existing go install before extracting new version [Go] Delete existing go install before extracting new version Aug 26, 2024
@mitesch
Copy link
Author

mitesch commented Sep 24, 2024

@samruddhikhandale can you take another look when you have a minute?

Comment on lines -38 to -39
"install_go_centos-7": {
"image": "centos:centos7",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep this as is? For the test failures, you can pull from main which would have a fix for it.

@@ -89,5 +89,13 @@
"version": "1.19"
}
}
},
"install_go_1_23_over_1_22": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +281 to +282
echo "Removing existing Go ${TARGET_GOROOT}..."
rm -rf "${TARGET_GOROOT:?}/"*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Removing existing Go ${TARGET_GOROOT}..."
rm -rf "${TARGET_GOROOT:?}/"*
if [ -n "${TARGET_GOROOT}" ] && [ -d "${TARGET_GOROOT}" ]; then
echo "Removing existing Go installation at ${TARGET_GOROOT}..."
rm -rf "${TARGET_GOROOT}/"*
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants