From 314d15b3fbdd3924cfd4f70f115fbac2c3070094 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 12 May 2021 13:12:41 -0700 Subject: [PATCH] version: add func IsRace to report whether race detector enabled Signed-off-by: Brad Fitzpatrick --- version/race.go | 11 +++++++++++ version/race_off.go | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 version/race.go create mode 100644 version/race_off.go diff --git a/version/race.go b/version/race.go new file mode 100644 index 000000000..21972fa9a --- /dev/null +++ b/version/race.go @@ -0,0 +1,11 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build race + +package version + +// IsRace reports whether the current binary was built with the Go +// race detector enabled. +func IsRace() bool { return true } diff --git a/version/race_off.go b/version/race_off.go new file mode 100644 index 000000000..9876efc1b --- /dev/null +++ b/version/race_off.go @@ -0,0 +1,11 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !race + +package version + +// IsRace reports whether the current binary was built with the Go +// race detector enabled. +func IsRace() bool { return false }