github.com/neilgarb/delve@v1.9.2-nobreaks/_scripts/test_linux.sh (about)

     1  #!/bin/bash
     2  set -e
     3  set -x
     4  
     5  apt-get -qq update
     6  apt-get install -y dwz wget make git gcc curl jq lsof
     7  
     8  dwz --version
     9  
    10  version=$1
    11  arch=$2
    12  
    13  function getgo {
    14  	export GOROOT=/usr/local/go/$1
    15  	if [ ! -d "$GOROOT" ]; then
    16  		wget -q https://dl.google.com/go/"$1".linux-"${arch}".tar.gz
    17  		mkdir -p /usr/local/go
    18  		tar -C /usr/local/go -xzf "$1".linux-"${arch}".tar.gz
    19  		mv -f /usr/local/go/go "$GOROOT"
    20  	fi
    21  }
    22  
    23  if [ "$version" = "gotip" ]; then
    24  	echo Building Go from tip
    25  	getgo $(curl https://go.dev/VERSION?m=text)
    26  	export GOROOT_BOOTSTRAP=$GOROOT
    27  	export GOROOT=/usr/local/go/go-tip
    28  	git clone https://go.googlesource.com/go /usr/local/go/go-tip
    29  	cd /usr/local/go/go-tip/src
    30  	./make.bash
    31  	cd -
    32  else
    33  	echo Finding latest patch version for $version
    34  	version=$(curl 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.|beta|rc)' | sort -rV | head -1)
    35  	echo "Go $version on $arch"
    36  	getgo $version
    37  fi
    38  
    39  
    40  GOPATH=$(pwd)/go
    41  export GOPATH
    42  export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
    43  go version
    44  go install honnef.co/go/tools/cmd/staticcheck@2021.1.1 || true
    45  
    46  uname -a
    47  echo "$PATH"
    48  echo "$GOROOT"
    49  echo "$GOPATH"
    50  cd delve
    51  
    52  # Starting with go1.18 'go build' and 'go run' will try to stamp the build
    53  # with the current VCS revision, which does not work with TeamCity
    54  if [ "$version" = "gotip" ]; then
    55  	export GOFLAGS=-buildvcs=false
    56  elif [ ${version:4:2} -gt 17 ]; then
    57  	export GOFLAGS=-buildvcs=false
    58  fi
    59  
    60  set +e
    61  make test
    62  x=$?
    63  if [ "$version" = "gotip" ]; then
    64  	exit 0
    65  else
    66  	exit $x
    67  fi
    68