forked from cloudfoundry/python-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_go.sh
More file actions
executable file
·35 lines (26 loc) · 1022 Bytes
/
Copy pathinstall_go.sh
File metadata and controls
executable file
·35 lines (26 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -euo pipefail
GO_VERSION="1.11.4"
if [ $CF_STACK == "cflinuxfs2" ]; then
GO_SHA256="8faf0b1823cf25416aa5ffdac6eef2f105114abe41b31b3d020102ae7661a5ae"
elif [ $CF_STACK == "cflinuxfs3" ]; then
GO_SHA256="964b0b16d3a0b5ddf6705618537581e6ca7c101617a38ac0da4236685f0aa0ce"
fi
export GoInstallDir="/tmp/go$GO_VERSION"
mkdir -p $GoInstallDir
if [ ! -f $GoInstallDir/go/bin/go ]; then
URL=https://buildpacks.cloudfoundry.org/dependencies/go/go${GO_VERSION}.linux-amd64-${CF_STACK}-${GO_SHA256:0:8}.tar.gz
echo "-----> Download go ${GO_VERSION}"
curl -s -L --retry 15 --retry-delay 2 $URL -o /tmp/go.tar.gz
DOWNLOAD_SHA256=$(shasum -a 256 /tmp/go.tar.gz | cut -d ' ' -f 1)
if [[ $DOWNLOAD_SHA256 != $GO_SHA256 ]]; then
echo " **ERROR** SHA256 mismatch: got $DOWNLOAD_SHA256 expected $GO_SHA256"
exit 1
fi
tar xzf /tmp/go.tar.gz -C $GoInstallDir
rm /tmp/go.tar.gz
fi
if [ ! -f $GoInstallDir/go/bin/go ]; then
echo " **ERROR** Could not download go"
exit 1
fi