Versioning for gostations #2

Merged
gmgauthier merged 2 commits from versioning_for_gostations into master 2021-03-18 22:26:55 +00:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit 1cbf1c542e - Show all commits

12
build.sh Normal file → Executable file
View File

@ -1,10 +1,16 @@
#!/usr/bin/env sh
# shellcheck disable=SC2155
export GIT_COMMIT=$(git rev-list -1 HEAD)
GOPATH=$GOPATH:$(pwd)
export GOPATH
GIT_COMMIT=$(git rev-list -1 HEAD)
export GIT_COMMIT
CANONICAL_VERSION=$(cat ./VERSION)
VERSION_STRING="$CANONICAL_VERSION ($GIT_COMMIT)"
export CANONICAL_VERSION
VERSION_STRING="$CANONICAL_VERSION-$GIT_COMMIT"
export VERSION_STRING
go mod vendor
go mod tidy
go build -o build/gostations -ldflags "-X main.version=$VERSION_STRING"

View File

@ -6,7 +6,7 @@ import (
"os"
)
var version float32
var version string
func showVersion(){
fmt.Println(version)