From 3dfb1189f2828d99dca14b9da396ce4299ed46c3 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 28 Aug 2019 22:05:55 +0300 Subject: [PATCH 1/2] Makefile: fix binary name to be consistent And return back to using `neo-go` as the binary name because it's not just a node implementation, neo-go is capable of much more functionality. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 02d05f42a..8979e45de 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ BRANCH = "master" BUILD_TIME = "$(shell date -u +\"%Y-%m-%dT%H:%M:%SZ\")" REPONAME = "neo-go" NETMODE ?= "privnet" +BINARY = "./bin/neo-go" REPO ?= "$(shell go list -m)" VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" @@ -13,7 +14,7 @@ build: deps && export GOGC=off \ && export CGO_ENABLED=0 \ && echo $(VERSION)-$(BUILD_TIME) \ - && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ./bin/node ./cli/main.go + && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go image: deps @echo "=> Building image" @@ -46,7 +47,7 @@ push-to-registry: @docker push CityOfZion/${REPONAME} run: build - ./bin/neo-go node -config-path ./config -${NETMODE} + ${BINARY} node -config-path ./config -${NETMODE} run-cluster: build-linux @echo "=> Starting docker-compose cluster" From 6647317680545f52780019229c7fe5b41bbcec23 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 28 Aug 2019 22:09:36 +0300 Subject: [PATCH 2/2] config: drop BuildTime support, make builds reproducible Nobody cares, really. But we care about build being reproducible, one source tree corresponds to one binary with one checksum. --- Dockerfile | 3 +-- Makefile | 4 +--- config/config.go | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8114db1c..8bbcaa4ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,9 @@ ARG VERSION=dev # https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away # go build -mod=vendor RUN set -x \ - && export BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ && export GOGC=off \ && export CGO_ENABLED=0 \ - && export LDFLAGS="-X ${REPO}/config.Version=${VERSION} -X ${REPO}/config.BuildTime=${BUILD_TIME}" \ + && export LDFLAGS="-X ${REPO}/config.Version=${VERSION}" \ && go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/node ./cli/main.go # Executable image diff --git a/Makefile b/Makefile index 8979e45de..06cb00b08 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,17 @@ BRANCH = "master" -BUILD_TIME = "$(shell date -u +\"%Y-%m-%dT%H:%M:%SZ\")" REPONAME = "neo-go" NETMODE ?= "privnet" BINARY = "./bin/neo-go" REPO ?= "$(shell go list -m)" VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" -BUILD_FLAGS = "-X $(REPO)/config.Version=$(VERSION) -X $(REPO)/config.BuildTime=$(BUILD_TIME)" +BUILD_FLAGS = "-X $(REPO)/config.Version=$(VERSION)" build: deps @echo "=> Building binary" @set -x \ && export GOGC=off \ && export CGO_ENABLED=0 \ - && echo $(VERSION)-$(BUILD_TIME) \ && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go image: deps diff --git a/config/config.go b/config/config.go index 67eed94d6..e5e856f35 100644 --- a/config/config.go +++ b/config/config.go @@ -25,10 +25,6 @@ const ( var ( // Version the version of the node, set at build time. Version string - - // BuildTime the time and date the current version of the node built, - // set at build time. - BuildTime string ) type (