2021-01-18 15:48:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
apt-get -qq update
|
2021-04-12 21:56:12 +00:00
|
|
|
apt-get install -y dwz wget make git gcc curl jq lsof
|
2021-01-18 15:48:06 +00:00
|
|
|
dwz --version
|
|
|
|
|
2021-01-26 04:48:27 +00:00
|
|
|
version=$1
|
2021-01-18 15:48:06 +00:00
|
|
|
arch=$2
|
|
|
|
|
2021-01-26 04:48:27 +00:00
|
|
|
function getgo {
|
|
|
|
export GOROOT=/usr/local/go/$1
|
|
|
|
if [ ! -d "$GOROOT" ]; then
|
|
|
|
wget -q https://dl.google.com/go/"$1".linux-"${arch}".tar.gz
|
|
|
|
mkdir -p /usr/local/go
|
|
|
|
tar -C /usr/local/go -xzf "$1".linux-"${arch}".tar.gz
|
|
|
|
mv -f /usr/local/go/go "$GOROOT"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$version" = "gotip" ]; then
|
2021-07-12 16:48:11 +00:00
|
|
|
exit 0
|
2021-01-26 04:48:27 +00:00
|
|
|
echo Building Go from tip
|
|
|
|
getgo $(curl https://golang.org/VERSION?m=text)
|
|
|
|
export GOROOT_BOOTSTRAP=$GOROOT
|
|
|
|
export GOROOT=/usr/local/go/go-tip
|
|
|
|
git clone https://go.googlesource.com/go /usr/local/go/go-tip
|
|
|
|
cd /usr/local/go/go-tip/src
|
|
|
|
./make.bash
|
|
|
|
cd -
|
|
|
|
else
|
|
|
|
echo Finding latest patch version for $version
|
2021-07-24 18:14:45 +00:00
|
|
|
version=$(curl 'https://golang.org/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.|beta|rc)' | sort -rV | head -1)
|
2021-01-26 04:48:27 +00:00
|
|
|
echo "Go $version on $arch"
|
|
|
|
getgo $version
|
2021-01-18 15:48:06 +00:00
|
|
|
fi
|
|
|
|
|
2021-01-26 04:48:27 +00:00
|
|
|
|
2021-01-18 15:48:06 +00:00
|
|
|
GOPATH=$(pwd)/go
|
|
|
|
export GOPATH
|
|
|
|
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
|
|
|
go version
|
|
|
|
|
|
|
|
uname -a
|
|
|
|
echo "$PATH"
|
|
|
|
echo "$GOROOT"
|
|
|
|
echo "$GOPATH"
|
|
|
|
cd delve
|
|
|
|
make test
|