From d103269a62156ec38955ce55b0f526f4bb1a7093 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sun, 8 Dec 2019 13:53:06 +0000 Subject: [PATCH] Get version information from git tag --- build/flags.sh | 1 + util/build/build.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/flags.sh b/build/flags.sh index c8ff00a2..0288e957 100755 --- a/build/flags.sh +++ b/build/flags.sh @@ -5,4 +5,5 @@ set -eu cd "$(dirname "${0}")/.." echo '-X "github.com/abcum/surreal/util/build.rev='$(git rev-parse HEAD)'"' \ + '-X "github.com/abcum/surreal/util/build.ver='$(git describe --tags --abbrev=0 || echo 0.0.0)'"' \ '-X "github.com/abcum/surreal/util/build.time='$(date -u '+%Y/%m/%d %H:%M:%S')'"' diff --git a/util/build/build.go b/util/build/build.go index dd2af545..8dec848d 100644 --- a/util/build/build.go +++ b/util/build/build.go @@ -19,9 +19,9 @@ import ( ) var ( - ver = "0.1.0" // Version number - rev string // Git revision of this build - time string // Build time in UTC (year/month/day hour:min:sec) + ver string // Version number + rev string // Git revision of this build + time string // Build time in UTC (year/month/day hour:min:sec) ) // Info holds information about the current build