2019-07-07 19:34:05 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-08-05 08:29:06 +03:00
|
|
|
VERSION="$(git describe --dirty)"
|
2019-07-07 19:34:05 +03:00
|
|
|
|
2019-08-04 20:07:14 +03:00
|
|
|
BINARY="moar"
|
|
|
|
if [ -n "$GOOS$GOARCH" ] ; then
|
|
|
|
BINARY="$BINARY-$VERSION-$GOOS-$GOARCH"
|
|
|
|
fi
|
|
|
|
|
2019-07-07 19:34:05 +03:00
|
|
|
# Linker flags trick below from here:
|
|
|
|
# https://www.reddit.com/r/golang/comments/4cpi2y/question_where_to_keep_the_version_number_of_a_go/d1kbap7?utm_source=share&utm_medium=web2x
|
|
|
|
|
|
|
|
# This line must be last in the script so that its return code
|
|
|
|
# propagates properly to its caller
|
2019-08-04 20:07:14 +03:00
|
|
|
go build -ldflags="-X main.versionString=$VERSION" -o "$BINARY"
|