From 5155d9176d4be23919062bb8635771193b82b921 Mon Sep 17 00:00:00 2001 From: Mike Tesch Date: Mon, 19 Aug 2024 13:35:24 -0400 Subject: [PATCH 1/2] Delete existing go install before extracting new version --- src/go/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/go/install.sh b/src/go/install.sh index 85fea5dc4..be1a6ab43 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 From ff747658498bec191a2fdad031a073a3a3365e5b Mon Sep 17 00:00:00 2001 From: Mike Tesch Date: Mon, 26 Aug 2024 15:18:55 +0000 Subject: [PATCH 2/2] Add test and up minor version --- src/go/devcontainer-feature.json | 2 +- src/go/install.sh | 2 +- test/go/install_go_1_23_over_1_22.sh | 12 ++++++++++++ ...install_go_centos-7.sh => install_go_centos-9.sh} | 0 test/go/scenarios.json | 12 ++++++++++-- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 test/go/install_go_1_23_over_1_22.sh rename test/go/{install_go_centos-7.sh => install_go_centos-9.sh} (100%) 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 be1a6ab43..1abdc4c5e 100755 --- a/src/go/install.sh +++ b/src/go/install.sh @@ -279,7 +279,7 @@ if [[ "${TARGET_GO_VERSION}" != "none" ]] && [[ "$(go version 2>/dev/null)" != * 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/* + 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