From 6647317680545f52780019229c7fe5b41bbcec23 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 28 Aug 2019 22:09:36 +0300 Subject: [PATCH] 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 (