diff options
author | Jakob Borg <jakob@nym.se> | 2014-06-13 20:44:00 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-06-13 20:44:00 +0200 |
commit | 58c5e46206485aaed1774c8db7773dfffd98ced7 (patch) | |
tree | f2905652520dc8b382b40acb9db0cf6387903d05 | |
parent | 4c61ab0f1831113f34d5e1bab040c18c86471995 (diff) |
Add build environment variable
-rwxr-xr-x | build.sh | 3 | ||||
-rw-r--r-- | cmd/syncthing/main.go | 3 |
2 files changed, 4 insertions, 2 deletions
@@ -9,7 +9,8 @@ date=$(git show -s --format=%ct) user=$(whoami) host=$(hostname) host=${host%%.*} -ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host" +bldenv=${ENVIRONMENT:-default} +ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host -X main.BuildEnv $bldenv" check() { if ! command -v godep >/dev/null ; then diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 5a2c58a801..485bb08be0 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -36,6 +36,7 @@ import ( var ( Version = "unknown-dev" + BuildEnv = "default" BuildStamp = "0" BuildDate time.Time BuildHost = "unknown" @@ -50,7 +51,7 @@ func init() { BuildDate = time.Unix(int64(stamp), 0) date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST") - LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s) %s@%s %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date) + LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s %s) %s@%s %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildEnv, BuildUser, BuildHost, date) if os.Getenv("STTRACE") != "" { logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile |