main: add "-race" to the version string

...if we were compiled with "-race".
This commit is contained in:
Jakob Unterwurzacher 2017-05-06 14:26:34 +02:00
parent c52e1abc58
commit a48893b653
2 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,9 @@ var GitVersionFuse = pleaseBuildBash
// BuildTime is the Unix timestamp, set by build.bash // BuildTime is the Unix timestamp, set by build.bash
var BuildTime = "0" var BuildTime = "0"
// raceDetector is set to true by race.go if we are compiled with "go build -race"
var raceDetector bool
func usageText() { func usageText() {
printVersion() printVersion()
fmt.Printf(` fmt.Printf(`
@ -124,6 +127,9 @@ func printVersion() {
buildFlags = " without_openssl" buildFlags = " without_openssl"
} }
built := fmt.Sprintf("%s %s", humanTime, runtime.Version()) built := fmt.Sprintf("%s %s", humanTime, runtime.Version())
if raceDetector {
built += " -race"
}
fmt.Printf("%s %s%s; go-fuse %s; %s\n", fmt.Printf("%s %s%s; go-fuse %s; %s\n",
tlog.ProgramName, GitVersion, buildFlags, GitVersionFuse, built) tlog.ProgramName, GitVersion, buildFlags, GitVersionFuse, built)
} }

8
race.go Normal file
View File

@ -0,0 +1,8 @@
// +build race
package main
func init() {
// adds " -race" to the output of "gocryptfs -version"
raceDetector = true
}