Created
April 25, 2019 09:44
-
-
Save ajeetrai7/af4aa1a2104f77ce372a256b1b593b6c to your computer and use it in GitHub Desktop.
go-build_project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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