From 24e2ce076427725bd3ad9825c478b177508d99e7 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 27 Jul 2016 23:27:45 +0200 Subject: [PATCH] build: Allow easy influencing build user and build host To facilitate reproducible builds. --- build.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.go b/build.go index f0244cae8..b94869ebf 100644 --- a/build.go +++ b/build.go @@ -757,6 +757,10 @@ func buildStamp() int64 { } func buildUser() string { + if v := os.Getenv("BUILD_USER"); v != "" { + return v + } + u, err := user.Current() if err != nil { return "unknown-user" @@ -765,6 +769,10 @@ func buildUser() string { } func buildHost() string { + if v := os.Getenv("BUILD_HOST"); v != "" { + return v + } + h, err := os.Hostname() if err != nil { return "unknown-host"