2021-02-23 10:16:23 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
|
|
|
GOVERSION=$1
|
|
|
|
ARCH=$2
|
|
|
|
TMPDIR=$3
|
|
|
|
|
|
|
|
if [ "$GOVERSION" = "gotip" ]; then
|
2023-08-11 15:52:35 +00:00
|
|
|
bootstrapver=$(curl https://go.dev/VERSION?m=text | head -1)
|
2021-07-08 15:47:53 +00:00
|
|
|
cd $TMPDIR
|
2021-03-01 16:23:05 +00:00
|
|
|
curl -sSL "https://storage.googleapis.com/golang/$bootstrapver.darwin-$ARCH.tar.gz" | tar -xz
|
2021-07-08 15:47:53 +00:00
|
|
|
cd -
|
|
|
|
if [ -x $TMPDIR/go-tip ]; then
|
|
|
|
cd $TMPDIR/go-tip
|
|
|
|
git pull origin
|
|
|
|
else
|
|
|
|
git clone https://go.googlesource.com/go $TMPDIR/go-tip
|
|
|
|
fi
|
2021-03-01 16:23:05 +00:00
|
|
|
export GOROOT_BOOTSTRAP=$TMPDIR/go
|
|
|
|
export GOROOT=$TMPDIR/go-tip
|
|
|
|
cd $TMPDIR/go-tip/src
|
2021-02-23 10:16:23 +00:00
|
|
|
./make.bash
|
|
|
|
cd -
|
|
|
|
else
|
2021-03-01 16:23:05 +00:00
|
|
|
echo Finding latest patch version for $GOVERSION
|
2024-05-08 17:30:57 +00:00
|
|
|
GOVERSION=$(python3 _scripts/latestver.py $GOVERSION)
|
2021-03-01 16:23:05 +00:00
|
|
|
echo Go $GOVERSION on $ARCH
|
2021-02-23 10:16:23 +00:00
|
|
|
cd $TMPDIR
|
2021-03-01 16:23:05 +00:00
|
|
|
curl -sSL "https://storage.googleapis.com/golang/$GOVERSION.darwin-$ARCH.tar.gz" | tar -xz
|
2021-02-23 10:16:23 +00:00
|
|
|
cd -
|
2021-03-01 16:23:05 +00:00
|
|
|
export GOROOT="$TMPDIR/go"
|
2021-02-23 10:16:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $TMPDIR/gopath
|
|
|
|
|
2021-08-24 12:53:27 +00:00
|
|
|
go env
|
|
|
|
|
2021-02-23 10:16:23 +00:00
|
|
|
export GOPATH="$TMPDIR/gopath"
|
|
|
|
export GOARCH="$ARCH"
|
|
|
|
export PATH="$GOROOT/bin:$PATH"
|
2021-03-01 16:23:05 +00:00
|
|
|
go version
|
2021-02-23 10:16:23 +00:00
|
|
|
|
2022-04-27 16:10:23 +00:00
|
|
|
set +e
|
2021-02-23 10:16:23 +00:00
|
|
|
make test
|
2022-04-27 16:10:23 +00:00
|
|
|
x=$?
|
|
|
|
if [ "$GOVERSION" = "gotip" ]; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit $x
|
|
|
|
fi
|