forked from aws/eks-anywhere-build-tooling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_go_versions.sh
executable file
·59 lines (48 loc) · 2.39 KB
/
install_go_versions.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Taken from https://github.com/aws/eks-distro-build-tooling/blob/main/builder-base/install.sh
# TODO: introduce a shared scripts repo to better share things like this
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
source "${SCRIPT_ROOT}/common.sh"
setupgo() {
local -r version=$1
go install golang.org/dl/go${version}@latest
go${version} download
# Removing the patch number as we only care about the minor version of golang
local -r majorversion=$(cut -d. -f"1,2" <<< $version)
mkdir -p ${GOPATH}/go${majorversion}/bin
ln -sf ${GOPATH}/bin/go${version} ${GOPATH}/go${majorversion}/bin/go
ln -sf ${HOME}/sdk/go${version}/bin/gofmt ${GOPATH}/go${majorversion}/bin/gofmt
}
setupgo "${GOLANG116_VERSION:-1.16.15}"
setupgo "${GOLANG117_VERSION:-1.17.13}"
setupgo "${GOLANG118_VERSION:-1.18.10}"
setupgo "${GOLANG119_VERSION:-1.19.13}"
setupgo "${GOLANG120_VERSION:-1.20.10}"
build::common::use_go_version "1.16"
GOBIN=${GOPATH}/go1.16/bin go install github.com/jaxesn/go-licenses@4497a2a38565e4e6ad095ea8117c25ecd622d0cc
build::common::use_go_version "1.17"
GOBIN=${GOPATH}/go1.17/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48
build::common::use_go_version "1.18"
GOBIN=${GOPATH}/go1.18/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48
build::common::use_go_version "1.19"
GOBIN=${GOPATH}/go1.19/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48
build::common::use_go_version "1.20"
GOBIN=${GOPATH}/go1.20/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48
# 1.18 is the default so symlink it to /go/bin
ln -sf ${GOPATH}/go1.18/bin/go-licenses ${GOPATH}/bin