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.
This commit is contained in:
Roman Khimov 2019-08-28 22:09:36 +03:00
parent 3dfb1189f2
commit 6647317680
3 changed files with 2 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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 (