Skip to content

version: Include race build tag#888

Open
tcard wants to merge 4 commits intoprometheus:mainfrom
tcard:version-tags-race
Open

version: Include race build tag#888
tcard wants to merge 4 commits intoprometheus:mainfrom
tcard:version-tags-race

Conversation

@tcard
Copy link
Copy Markdown

@tcard tcard commented Mar 26, 2026

When gathering info, tags are extracted directly from the -tags build setting. However, this doesn't include the race build tag that is implicitly set when building with -race.

With this change, we explicitly check the presence of the race build tag with conditional compilation, and include it in the tags list if present.

@roidelapluie @gotjosh

Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
@tcard tcard force-pushed the version-tags-race branch from 46af3c8 to a420cd5 Compare March 26, 2026 15:33
Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
@tcard tcard force-pushed the version-tags-race branch from fc4806e to dbd712a Compare March 26, 2026 15:38
Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
@tcard tcard force-pushed the version-tags-race branch from 774b9a2 to 54b5955 Compare April 6, 2026 10:38
Copy link
Copy Markdown
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need //go:build !race etc. for this, see comment.

version/info.go Outdated
tags = v.Value + ",race"
} else {
tags = v.Value
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is an easier way of doing this.

If the race detector is enabled, the buildInfo.Settings contain an entry -race=true. So we simply need something like

		if v.Key == "-race" && v.Value == "true" {

with the appropriate flow later to assemble the right tags string, as we cannot expect a certain order of the -tags key and the -race key.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done at bd03eb9.

Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
@tcard tcard requested a review from beorn7 April 10, 2026 11:24
@roidelapluie
Copy link
Copy Markdown
Member

i do not think that race is a build tag, should it be in its own category (and not shown when false)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants