Skip to content

Commit a420cd5

Browse files
committed
version: Include race build tag
Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
1 parent 0dfcdfb commit a420cd5

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

version/info.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ func computeRevision() (string, string) {
126126
tags = "unknown"
127127
modified bool
128128
)
129+
if race {
130+
tags = "race"
131+
}
129132

130133
buildInfo, ok := debug.ReadBuildInfo()
131134
if !ok {
@@ -141,7 +144,11 @@ func computeRevision() (string, string) {
141144
}
142145
}
143146
if v.Key == "-tags" {
144-
tags = v.Value
147+
if race {
148+
tags = v.Value + ",race"
149+
} else {
150+
tags = v.Value
151+
}
145152
}
146153
}
147154
if modified {

version/info_norace.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2026 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build !race
15+
16+
package version
17+
18+
var race = false

version/info_race.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2026 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build race
15+
16+
package version
17+
18+
var race = true

0 commit comments

Comments
 (0)