forked from TrueCloudLab/neoneo-go
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:
parent
3dfb1189f2
commit
6647317680
3 changed files with 2 additions and 9 deletions
|
@ -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
|
# https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
|
||||||
# go build -mod=vendor
|
# go build -mod=vendor
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& export BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
|
||||||
&& export GOGC=off \
|
&& export GOGC=off \
|
||||||
&& export CGO_ENABLED=0 \
|
&& 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
|
&& go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/node ./cli/main.go
|
||||||
|
|
||||||
# Executable image
|
# Executable image
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -1,19 +1,17 @@
|
||||||
BRANCH = "master"
|
BRANCH = "master"
|
||||||
BUILD_TIME = "$(shell date -u +\"%Y-%m-%dT%H:%M:%SZ\")"
|
|
||||||
REPONAME = "neo-go"
|
REPONAME = "neo-go"
|
||||||
NETMODE ?= "privnet"
|
NETMODE ?= "privnet"
|
||||||
BINARY = "./bin/neo-go"
|
BINARY = "./bin/neo-go"
|
||||||
|
|
||||||
REPO ?= "$(shell go list -m)"
|
REPO ?= "$(shell go list -m)"
|
||||||
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
|
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
|
build: deps
|
||||||
@echo "=> Building binary"
|
@echo "=> Building binary"
|
||||||
@set -x \
|
@set -x \
|
||||||
&& export GOGC=off \
|
&& export GOGC=off \
|
||||||
&& export CGO_ENABLED=0 \
|
&& export CGO_ENABLED=0 \
|
||||||
&& echo $(VERSION)-$(BUILD_TIME) \
|
|
||||||
&& go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go
|
&& go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go
|
||||||
|
|
||||||
image: deps
|
image: deps
|
||||||
|
|
|
@ -25,10 +25,6 @@ const (
|
||||||
var (
|
var (
|
||||||
// Version the version of the node, set at build time.
|
// Version the version of the node, set at build time.
|
||||||
Version string
|
Version string
|
||||||
|
|
||||||
// BuildTime the time and date the current version of the node built,
|
|
||||||
// set at build time.
|
|
||||||
BuildTime string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Loading…
Reference in a new issue