diff --git a/src/go/devcontainer-feature.json b/src/go/devcontainer-feature.json index afb1f9128..eaf1a7f17 100644 --- a/src/go/devcontainer-feature.json +++ b/src/go/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "go", - "version": "1.3.1", + "version": "1.3.2", "name": "Go", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/go", "description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.", diff --git a/src/go/install.sh b/src/go/install.sh index 85fea5dc4..1abdc4c5e 100755 --- a/src/go/install.sh +++ b/src/go/install.sh @@ -278,6 +278,8 @@ if [[ "${TARGET_GO_VERSION}" != "none" ]] && [[ "$(go version 2>/dev/null)" != * fi curl -fsSL -o /tmp/go.tar.gz.asc "https://golang.org/dl/go${TARGET_GO_VERSION}.linux-${architecture}.tar.gz.asc" gpg --verify /tmp/go.tar.gz.asc /tmp/go.tar.gz + echo "Removing existing Go ${TARGET_GOROOT}..." + rm -rf "${TARGET_GOROOT:?}/"* echo "Extracting Go ${TARGET_GO_VERSION}..." tar -xzf /tmp/go.tar.gz -C "${TARGET_GOROOT}" --strip-components=1 rm -rf /tmp/go.tar.gz /tmp/go.tar.gz.asc /tmp/tmp-gnupg diff --git a/test/go/install_go_1_23_over_1_22.sh b/test/go/install_go_1_23_over_1_22.sh new file mode 100755 index 000000000..92f396fba --- /dev/null +++ b/test/go/install_go_1_23_over_1_22.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# golangci is a smoke test to ensure the go install directory doesn't have leftover files from 1.22 +check "install golangci-lint to verify the go install" bash -c "go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2" + +# Report result +reportResults diff --git a/test/go/install_go_centos-7.sh b/test/go/install_go_centos-9.sh similarity index 100% rename from test/go/install_go_centos-7.sh rename to test/go/install_go_centos-9.sh diff --git a/test/go/scenarios.json b/test/go/scenarios.json index b6d8d1d0b..c89612c3b 100644 --- a/test/go/scenarios.json +++ b/test/go/scenarios.json @@ -35,8 +35,8 @@ } } }, - "install_go_centos-7": { - "image": "centos:centos7", + "install_go_centos-9": { + "image": "quay.io/centos/centos:stream9", "features": { "go": { "version": "latest", @@ -89,5 +89,13 @@ "version": "1.19" } } + }, + "install_go_1_23_over_1_22": { + "image": "mcr.microsoft.com/devcontainers/go:1.22", + "features": { + "go": { + "version": "1.23" + } + } } } \ No newline at end of file