From 29df24fa6c555cbfa39fe17c0070afa815dc2bbf Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 8 Jul 2020 05:05:52 +0200 Subject: [PATCH] Allow to override build date with SOURCE_DATE_EPOCH in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. This date call only works with GNU date. Also use UTC to be independent of timezone. --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 882a23e5..60b5d040 100755 --- a/build +++ b/build @@ -19,7 +19,7 @@ if [ -z "$VERSION" ]; then fi set -e fi -DATE=$(date --iso-8601=seconds) +DATE=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --iso-8601=seconds) COMMIT=${COMMIT:-$(git rev-parse --verify HEAD)} LDFLAGS="-X main.version=${VERSION:-master} -X main.commit=${COMMIT} -X main.date=${DATE}" export CGO_ENABLED=0