From ff50ddf1ee7ffffbfd30d8aad780ae34024352a0 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 16 Nov 2020 10:11:53 -0800 Subject: [PATCH] util/racebuild: add package to export a race-is-enabled const --- util/racebuild/off.go | 9 +++++++++ util/racebuild/on.go | 9 +++++++++ util/racebuild/racebuild.go | 7 +++++++ 3 files changed, 25 insertions(+) create mode 100644 util/racebuild/off.go create mode 100644 util/racebuild/on.go create mode 100644 util/racebuild/racebuild.go diff --git a/util/racebuild/off.go b/util/racebuild/off.go new file mode 100644 index 000000000..37f0f7cf1 --- /dev/null +++ b/util/racebuild/off.go @@ -0,0 +1,9 @@ +// Copyright (c) 2020 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 racebuild + +const On = false diff --git a/util/racebuild/on.go b/util/racebuild/on.go new file mode 100644 index 000000000..b318aa1b3 --- /dev/null +++ b/util/racebuild/on.go @@ -0,0 +1,9 @@ +// Copyright (c) 2020 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 racebuild + +const On = true diff --git a/util/racebuild/racebuild.go b/util/racebuild/racebuild.go new file mode 100644 index 000000000..30aad83e9 --- /dev/null +++ b/util/racebuild/racebuild.go @@ -0,0 +1,7 @@ +// Copyright (c) 2020 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. + +// Package racebuild exports a constant about whether the current binary +// was built with the race detector. +package racebuild