Skip to content

feat: add test compilation check to precommit hook#11

Merged
gonzaloserrano merged 1 commit intomainfrom
gsr/add-test-compile-precommit
Mar 18, 2026
Merged

feat: add test compilation check to precommit hook#11
gonzaloserrano merged 1 commit intomainfrom
gsr/add-test-compile-precommit

Conversation

@gonzaloserrano
Copy link
Copy Markdown
Owner

go build skips _test.go files, so API breakages in tests go undetected. Add go test -run='^$' -count=0 to compile test files without running them.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/go-precommit.sh">

<violation number="1" location="scripts/go-precommit.sh:36">
P2: `-run='^$'` still runs each package's test binary, so `TestMain` setup/teardown can execute during pre-commit. That makes this hook fail for runtime-only test setup instead of only checking test compilation.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Use go test -exec true to compile test files without executing
them (avoids TestMain side effects during precommit).
@gonzaloserrano gonzaloserrano force-pushed the gsr/add-test-compile-precommit branch from 408bdbf to 3cea958 Compare March 18, 2026 13:29
@gonzaloserrano gonzaloserrano merged commit b1dd287 into main Mar 18, 2026
1 check passed
@gonzaloserrano gonzaloserrano deleted the gsr/add-test-compile-precommit branch March 18, 2026 13:30
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