Created
July 9, 2015 09:03
-
-
Save stevenwilkin/3928c453487ae514097e to your computer and use it in GitHub Desktop.
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
# build go static binary from root of project | |
gostatic(){ | |
local dir=$1 | |
if [[ -z $dir ]]; then | |
dir=$(pwd) | |
fi | |
local name=$(basename "$dir") | |
( | |
cd $dir | |
echo "Building static binary for $name in $dir" | |
GOOS=linux go build -a \ | |
-tags 'netgo static_build' \ | |
-installsuffix netgo \ | |
-ldflags " | |
-w | |
" \ | |
-o "$name" . | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment