git » gofer » commit 1e1c31a

Fix embedded version reference

author Alberto Bertogli
2020-06-08 01:04:12 UTC
committer Alberto Bertogli
2020-06-08 01:09:50 UTC
parent 7b3d0c04fdc54ef8fe716f547737649d6ce21840

Fix embedded version reference

Makefile +2 -2
debug/debug.go +1 -1
gofer.go +1 -1
test/test.sh +1 -1

diff --git a/Makefile b/Makefile
index b102122..23ae91f 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,8 @@ default: gofer
 
 gofer:
 	go build -ldflags="\
-		-X main.version=${VERSION} \
-		-X main.sourceDateTs=${SOURCE_DATE_EPOCH} \
+		-X blitiri.com.ar/go/gofer/debug.Version=${VERSION} \
+		-X blitiri.com.ar/go/gofer/debug.SourceDateTs=${SOURCE_DATE_EPOCH} \
 		" ${GOFLAGS}
 
 test:
diff --git a/debug/debug.go b/debug/debug.go
index cb21f34..a9379b0 100644
--- a/debug/debug.go
+++ b/debug/debug.go
@@ -15,7 +15,7 @@ import (
 )
 
 // Build information, overridden at build time using
-// -ldflags="-X blitiri.com.ar/go/gofer/internal/debug.Version=blah".
+// -ldflags="-X blitiri.com.ar/go/gofer/debug.Version=blah".
 var (
 	Version      = "undefined"
 	SourceDateTs = "0"
diff --git a/gofer.go b/gofer.go
index 4e2d785..573cb0a 100644
--- a/gofer.go
+++ b/gofer.go
@@ -22,7 +22,7 @@ var (
 func main() {
 	flag.Parse()
 	log.Init()
-	log.Infof("gofer starting")
+	log.Infof("gofer starting (%s, %s)", debug.Version, debug.SourceDateStr)
 
 	conf, err := config.Load(*configfile)
 	if err != nil {
diff --git a/test/test.sh b/test/test.sh
index 3a28c18..d45704d 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -24,7 +24,7 @@ if [ "$COVER_DIR" != "" ]; then
 		mv gofer.test gofer
 	)
 else
-	( cd ..; go build $GO_FLAGS )
+	( cd ..; make )
 fi
 ( cd util; go build exp.go )