From e34af8d6eb35517ace0ce9ae719c93ea51c6556d Mon Sep 17 00:00:00 2001 From: Daniel Regeci Date: Tue, 10 Apr 2018 18:36:11 +0800 Subject: [PATCH] Create status-go API to return a current revision (#804) Change `BUILD_FLAGS` in Makefile and update `github.com/status-im/status-go/geth/params.VersionMeta` value with the current Git SHA. --- Makefile | 3 ++- geth/params/version.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d61932ce9..7dc8726d8 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,9 @@ endif CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin +GIT_COMMIT := $(shell git rev-parse --short HEAD) -BUILD_FLAGS := $(shell echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(git rev-parse HEAD)'") +BUILD_FLAGS := $(shell echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(GIT_COMMIT) -X github.com/status-im/status-go/geth/params.VersionMeta=$(GIT_COMMIT)'") GO ?= latest XGOVERSION ?= 1.9.2 diff --git a/geth/params/version.go b/geth/params/version.go index 046383d60..0d0dab76a 100644 --- a/geth/params/version.go +++ b/geth/params/version.go @@ -13,10 +13,10 @@ const ( // VersionPatch is a patch version component of the current release VersionPatch = 9 - - // VersionMeta is metadata to append to the version string - VersionMeta = "unstable" ) +// VersionMeta is metadata to append to the version string +var VersionMeta string // rely on linker: -ldflags -X github.com/status-im/status-go/geth/params.VersionMeta" + // Version exposes string representation of program version. var Version = fmt.Sprintf("%d.%d.%d-%s", VersionMajor, VersionMinor, VersionPatch, VersionMeta)