diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 0b7d4ea..739b524 --- a/build.sh +++ b/build.sh @@ -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" diff --git a/stations.go b/stations.go index f4d8877..4accb94 100644 --- a/stations.go +++ b/stations.go @@ -6,7 +6,7 @@ import ( "os" ) -var version float32 +var version string func showVersion(){ fmt.Println(version)