add optional version parameter to build scripts

Related #103
This commit is contained in:
Gokcehan committed 2018-06-26 17:09:05 +03:00
1 parent fe786aae4c
commit 4c54acebeb
2 files changed
+8 -6

No files matched your search

+4 -2
View File
@@ -4,6 +4,8 @@
# This script is used to build a binary for the current platform. Cgo is
# disabled to make sure the binary is statically linked. Appropriate flags are
# given to the go compiler to strip the binary. Current git tag is passed to
# the compiler to be used as the version in the binary.
# the compiler by default to be used as the version in the binary.
CGO_ENABLED=0 go build -ldflags="-s -w -X main.gVersion=$(git describe --tags)" "$@"
[ -z $version ] && version=$(git describe --tags)
CGO_ENABLED=0 go build -ldflags="-s -w -X main.gVersion=$version" "$@"