Skip to content

Run race detector in test target, not build#23

Merged
jenting merged 1 commit into
mainfrom
fix/makefile-race-flag
Jun 11, 2026
Merged

Run race detector in test target, not build#23
jenting merged 1 commit into
mainfrom
fix/makefile-race-flag

Conversation

@jenting

@jenting jenting commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

Moves the -race flag from the build target to the test target:

  • test: go test -race ./...
  • build: go build -o grafana-operator-webhook -v .

Why

Go's -race flag enables the data race detector, which only does anything meaningful while running code under test. Building the production binary with -race just produced a slower, larger artifact with no benefit, while tests — where races actually surface — ran without it. This swaps them so races can actually be caught in CI.

Testing

  • make test — passes with the race detector enabled
  • make build — produces a clean binary

🤖 Generated with Claude Code

The -race flag enables Go's data race detector, which only does anything
meaningful while running tests. Building with -race produced a slower,
larger binary for no benefit. Move -race to the test target where it can
actually catch races, and build a clean binary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jenting jenting merged commit f9cbf3f into main Jun 11, 2026
6 checks passed
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.

1 participant