From a48893b653085b067f91e11806e4de017741d509 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 6 May 2017 14:26:34 +0200 Subject: main: add "-race" to the version string ...if we were compiled with "-race". --- main.go | 6 ++++++ race.go | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 race.go diff --git a/main.go b/main.go index 9301ae1..2a7d435 100644 --- a/main.go +++ b/main.go @@ -39,6 +39,9 @@ var GitVersionFuse = pleaseBuildBash // BuildTime is the Unix timestamp, set by build.bash var BuildTime = "0" +// raceDetector is set to true by race.go if we are compiled with "go build -race" +var raceDetector bool + func usageText() { printVersion() fmt.Printf(` @@ -124,6 +127,9 @@ func printVersion() { buildFlags = " without_openssl" } built := fmt.Sprintf("%s %s", humanTime, runtime.Version()) + if raceDetector { + built += " -race" + } fmt.Printf("%s %s%s; go-fuse %s; %s\n", tlog.ProgramName, GitVersion, buildFlags, GitVersionFuse, built) } diff --git a/race.go b/race.go new file mode 100644 index 0000000..a17501a --- /dev/null +++ b/race.go @@ -0,0 +1,8 @@ +// +build race + +package main + +func init() { + // adds " -race" to the output of "gocryptfs -version" + raceDetector = true +} -- cgit v1.2.3