Skip to content

Commit 7f756b3

Browse files
authored
Fixes #143 (#144)
* Fixes #143 Downloads go source into a temporary location, outside of the cloned project source repository. This keeps the cloned repository clean by reporting no new files or changes in `git status`. * Remove extra newlines Remove "extra" new lines
1 parent 02b8d0d commit 7f756b3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

setup-go.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash -eux
2+
TEMP="$(mktemp -d)"
3+
trap 'rm -rf $TEMP' EXIT ERR INT
24

35
ARCH=$(dpkg --print-architecture)
46
GO_LINUX_PACKAGE_URL="https://go.dev/dl/$(curl https://go.dev/VERSION?m=text | head -n1).linux-${ARCH}.tar.gz"
@@ -25,13 +27,14 @@ elif [[ -n ${INPUT_GOVERSION} ]]; then
2527
GO_LINUX_PACKAGE_URL="https://go.dev/dl/go${INPUT_GOVERSION}.linux-${ARCH}.tar.gz"
2628
fi
2729

28-
wget --progress=dot:mega ${GO_LINUX_PACKAGE_URL} -O go-linux.tar.gz
29-
tar -zxf go-linux.tar.gz
30-
mv go /usr/local/
30+
wget --progress=dot:mega ${GO_LINUX_PACKAGE_URL} -O "$TEMP/go-linux.tar.gz"
31+
(
32+
cd "$TEMP" || exit 1
33+
tar -zxf go-linux.tar.gz
34+
mv go /usr/local/
35+
)
3136
mkdir -p /go/bin /go/src /go/pkg
3237

3338
export GO_HOME=/usr/local/go
3439
export GOPATH=/go
3540
export PATH=${GOPATH}/bin:${GO_HOME}/bin/:$PATH
36-
37-

0 commit comments

Comments
 (0)