github.com/brownsys/tracing-framework-go@v0.0.0-20161210174012-0542a62412fe/bin/go (about) 1 #!/bin/bash 2 3 # This script calls the real go binary with GOROOT 4 # set to the location of the modified go tree. 5 # It assumes that the file hierarchy looks like: 6 # / 7 # bin/ 8 # go # this script 9 # go/ # GOROOT 10 11 # source: http://stackoverflow.com/a/4774063/836390 12 pushd `dirname $0` > /dev/null 13 SCRIPTPATH=`pwd -P` 14 popd > /dev/null 15 16 case "`uname -s`" in 17 Darwin) 18 OS=darwin 19 ;; 20 Linux) 21 OS=linux 22 ;; 23 *) 24 echo "Unsupported OS: `uname -s`" >&2 25 exit 1 26 esac 27 28 case "`uname -m`" in 29 x86_64) 30 ARCH=amd64 31 ;; 32 i.86) 33 ARCH=386 34 ;; 35 *) 36 echo "Unsupported architecture: `uname -m`" >&2 37 exit 1 38 esac 39 40 PLATFORM=${OS}_$ARCH 41 export GOROOT=`dirname $SCRIPTPATH`/go/$PLATFORM 42 43 if ! [ -d "$GOROOT" ]; then 44 echo "Unsupported platform: $PLATFORM" >&2 45 exit 1 46 fi 47 48 $GOROOT/bin/go "$@" 49 exit $?