Skip to content

Commit

Permalink
feat: race build tag flag detector
Browse files Browse the repository at this point in the history
`RaceEnabled` is populated depending on the provided build tags.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed May 25, 2021
1 parent 5b292e5 commit 3d0a6e1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

`go-debug` is a Sidero-specific library for including debugging facilities for developers in our products when they are compiled with `sidero.debug` build tag.
They are not included by default.
Also provides utils for detecting if the code was compiled with `race` build tag.
1 change: 1 addition & 0 deletions debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Package debug is a Sidero-specific library for including debugging facilities for developers in our products
// when they are compiled with sidero.debug build tag. They are not included by default.
// Also provides utils for detecting if the code was compiled with race build tag.
package debug

import (
Expand Down
10 changes: 10 additions & 0 deletions race_off.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// +build !race

package debug

// RaceEnabled is false when compiled without race build tag.
const RaceEnabled = false
10 changes: 10 additions & 0 deletions race_on.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// +build race

package debug

// RaceEnabled is true when compiled with race build tag.
const RaceEnabled = true

0 comments on commit 3d0a6e1

Please sign in to comment.