Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 2323654

Browse files
author
CI
committed
Automated update for script library changes
1 parent 96ffcf3 commit 2323654

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

containers/codespaces-linux/.devcontainer/library-scripts/go-debian.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,26 @@ if [ "${TARGET_GO_VERSION}" != "none" ] && ! type go > /dev/null 2>&1; then
170170
set -e
171171
if [ "$exit_code" != "0" ]; then
172172
echo "(!) Download failed."
173-
# Try one break fix version number less if we get a failure
173+
# Try one break fix version number less if we get a failure. Use "set +e" since "set -e" can cause failures in valid scenarios.
174+
set +e
174175
major="$(echo "${TARGET_GO_VERSION}" | grep -oE '^[0-9]+' || echo '')"
175176
minor="$(echo "${TARGET_GO_VERSION}" | grep -oP '^[0-9]+\.\K[0-9]+' || echo '')"
176177
breakfix="$(echo "${TARGET_GO_VERSION}" | grep -oP '^[0-9]+\.[0-9]+\.\K[0-9]+' 2>/dev/null || echo '')"
178+
# Handle Go's odd version pattern where "0" releases omit the last part
177179
if [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then
178180
((minor=minor-1))
179181
TARGET_GO_VERSION="${major}.${minor}"
182+
# Look for latest version from previous minor release
180183
find_version_from_git_tags TARGET_GO_VERSION "https://go.googlesource.com/go" "tags/go" "." "true"
181184
else
182185
((breakfix=breakfix-1))
183-
TARGET_GO_VERSION="${major}.${minor}.${breakfix}"
186+
if [ "${breakfix}" = "0" ]; then
187+
TARGET_GO_VERSION="${major}.${minor}"
188+
else
189+
TARGET_GO_VERSION="${major}.${minor}.${breakfix}"
190+
fi
184191
fi
192+
set -e
185193
echo "Trying ${TARGET_GO_VERSION}..."
186194
curl -fsSL -o /tmp/go.tar.gz "https://golang.org/dl/go${TARGET_GO_VERSION}.linux-${architecture}.tar.gz"
187195
fi

containers/go/.devcontainer/library-scripts/go-debian.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,26 @@ if [ "${TARGET_GO_VERSION}" != "none" ] && ! type go > /dev/null 2>&1; then
170170
set -e
171171
if [ "$exit_code" != "0" ]; then
172172
echo "(!) Download failed."
173-
# Try one break fix version number less if we get a failure
173+
# Try one break fix version number less if we get a failure. Use "set +e" since "set -e" can cause failures in valid scenarios.
174+
set +e
174175
major="$(echo "${TARGET_GO_VERSION}" | grep -oE '^[0-9]+' || echo '')"
175176
minor="$(echo "${TARGET_GO_VERSION}" | grep -oP '^[0-9]+\.\K[0-9]+' || echo '')"
176177
breakfix="$(echo "${TARGET_GO_VERSION}" | grep -oP '^[0-9]+\.[0-9]+\.\K[0-9]+' 2>/dev/null || echo '')"
178+
# Handle Go's odd version pattern where "0" releases omit the last part
177179
if [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then
178180
((minor=minor-1))
179181
TARGET_GO_VERSION="${major}.${minor}"
182+
# Look for latest version from previous minor release
180183
find_version_from_git_tags TARGET_GO_VERSION "https://go.googlesource.com/go" "tags/go" "." "true"
181184
else
182185
((breakfix=breakfix-1))
183-
TARGET_GO_VERSION="${major}.${minor}.${breakfix}"
186+
if [ "${breakfix}" = "0" ]; then
187+
TARGET_GO_VERSION="${major}.${minor}"
188+
else
189+
TARGET_GO_VERSION="${major}.${minor}.${breakfix}"
190+
fi
184191
fi
192+
set -e
185193
echo "Trying ${TARGET_GO_VERSION}..."
186194
curl -fsSL -o /tmp/go.tar.gz "https://golang.org/dl/go${TARGET_GO_VERSION}.linux-${architecture}.tar.gz"
187195
fi

0 commit comments

Comments
 (0)