build: Allow easy influencing build user and build host

To facilitate reproducible builds.
This commit is contained in:
Jakob Borg 2016-07-27 23:27:45 +02:00
parent d7cb4d407b
commit 24e2ce0764
1 changed files with 8 additions and 0 deletions

View File

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