Skip to content

Instantly share code, notes, and snippets.

@ajeetrai7
Created April 25, 2019 09:44
Show Gist options
  • Save ajeetrai7/af4aa1a2104f77ce372a256b1b593b6c to your computer and use it in GitHub Desktop.
Save ajeetrai7/af4aa1a2104f77ce372a256b1b593b6c to your computer and use it in GitHub Desktop.
go-build_project
#!/usr/bin/bash
WORKROOT=$(pwd)
cd ${WORKROOT}
# unzip go environment
go_env="go1.6.2.linux-amd64.tar.gz"
wget -c http://path/to/go/go1.6.2.linux-amd64.tar.gz
tar -zxf $go_env
if [ $? -ne 0 ];
then
echo "fail in extract go"
exit 1
fi
echo "OK for extract go"
rm -rf $go_env
# prepare PATH, GOROOT and GOPATH
export PATH=$(pwd)/go/bin:$PATH
export GOROOT=$(pwd)/go
export GOPATH=$(pwd)
# build
cd path/to/your/project
go build
if [ $? -ne 0 ];
then
echo "fail to go build"
exit 1
fi
echo "OK for go build"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment