From 902125cbeb94fe6d8b1014fbd4fe73cf8cb08c2d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 26 Aug 2019 17:05:17 +0300 Subject: [PATCH] Change the way to receive version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Used git to receive version from tags (see #304) - Version now displayed when start node (fix #102) Example: → ./bin/node --version neo-go version 0.44.10-245-g67d5e9f → ./bin/node -v neo-go version 0.44.10-245-g67d5e9f --- Makefile | 3 ++- cli/main.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ae2710240..bbd31495c 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ BRANCH = "master" BUILD_TIME = "$(shell date -u +\"%Y-%m-%dT%H:%M:%SZ\")" -VERSION = $(shell cat ./VERSION) REPONAME = "neo-go" NETMODE ?= "privnet" +VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" + build: @echo "=> Building darwin binary" @go build -i -ldflags "-X github.com/CityOfZion/neo-go/config.Version=${VERSION}-dev -X github.com/CityOfZion/neo-go/config.BuildTime=${BUILD_TIME}" -o ./bin/neo-go ./cli/main.go diff --git a/cli/main.go b/cli/main.go index 7e98ae169..e58aaf157 100644 --- a/cli/main.go +++ b/cli/main.go @@ -7,12 +7,14 @@ import ( "github.com/CityOfZion/neo-go/cli/smartcontract" "github.com/CityOfZion/neo-go/cli/vm" "github.com/CityOfZion/neo-go/cli/wallet" + "github.com/CityOfZion/neo-go/config" "github.com/urfave/cli" ) func main() { ctl := cli.NewApp() ctl.Name = "neo-go" + ctl.Version = config.Version ctl.Usage = "Official Go client for Neo" ctl.Commands = []cli.Command{