Skip to content

Commit eff5732

Browse files
authored
NO-ISSUE: use the matching checksum when downloading go (#1847)
1 parent acf04c4 commit eff5732

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

01_install_requirements.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,29 @@ elif [[ $GOARCH == "x86_64" ]]; then
156156
GOARCH="amd64"
157157
fi
158158

159+
VERSION="go${GO_VERSION}"
160+
OS="linux"
161+
162+
GO_CHECKSUM="$(
163+
curl -s "https://go.dev/dl/?mode=json&include=all" | jq -r \
164+
--arg version "$VERSION" \
165+
--arg os "$OS" \
166+
--arg arch "$GOARCH" \
167+
'
168+
.[]
169+
| select(.version == $version)
170+
| .files[]
171+
| select(.os == $os and .arch == $arch)
172+
| .sha256
173+
'
174+
)"
175+
176+
if [ -z "$GO_CHECKSUM" ]; then
177+
echo "Error: Could not find checksum for $VERSION ($OS/$ARCH)" >&2
178+
else
179+
echo "Checksum: $GO_CHECKSUM"
180+
fi
181+
159182
# Also need the 3.9 version of netaddr for ansible.netcommon
160183
# and lxml for the pyxpath script
161184
sudo python -m pip install netaddr lxml
@@ -172,6 +195,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \
172195
-e "virthost=$HOSTNAME" \
173196
-e "go_version=$GO_VERSION" \
174197
-e "go_custom_mirror=$GO_CUSTOM_MIRROR" \
198+
-e "go_checksum=$GO_CHECKSUM" \
175199
-e "GOARCH=$GOARCH" \
176200
$ALMA_PYTHON_OVERRIDE \
177201
-i vm-setup/inventory.ini \

0 commit comments

Comments
 (0)