1
1
mirror of https://github.com/walles/moar.git synced 2024-09-21 17:08:34 +03:00
moar/build.sh
Johan Walles f0dead13ad Move historical releases into their own directory
Because of <https://github.com/microsoft/vscode/issues/38878> vscode
doesn't handle having old releases in the top dir. This change moves
them away.
2020-12-30 18:43:25 +01:00

16 lines
495 B
Bash
Executable File

#!/bin/bash
VERSION="$(git describe --dirty)"
BINARY="moar"
if [ -n "$GOOS$GOARCH" ] ; then
BINARY="releases/$BINARY-$VERSION-$GOOS-$GOARCH"
fi
# 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
go build -ldflags="-X main.versionString=$VERSION" -o "$BINARY"