chore: fix panicking benchmarks#1648
Merged
alexandear merged 7 commits intomgechev:masterfrom Feb 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses panics in the test package benchmarks and stabilizes formatter output in tests, while also adding convenient benchmark entry points via make bench and CI.
Changes:
- Fix benchmark helpers to use
testing.TBand update benchmarks to calltestRulewith*testing.B(avoids nil*testing.Tpanics). - Make
formattertests deterministic by disabling ANSI color output and adjust the Friendly formatter to honorcolor.NoColorat call time. - Add benchmark execution to the Makefile and GitHub Actions workflow.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
test/utils_test.go |
Generalize helper APIs from *testing.T to testing.TB to support both tests and benchmarks safely. |
test/argument_limit_test.go |
Update benchmark to use b.Loop() and pass b into testRule. |
test/file_header_test.go |
Update benchmark loop and pass b into testRule. |
test/imports_blocklist_test.go |
Update benchmark loop and pass b into testRule. |
test/unused_param_test.go |
Update benchmark loop and pass b into testRule. |
test/unused_receiver_test.go |
Update benchmark loop and pass b into testRule. |
test/var_naming_test.go |
Update benchmark loop and pass b into testRule. |
formatter/friendly.go |
Compute colored markers/headers at use-time so color.NoColor changes are respected. |
formatter/formatter_test.go |
Disable color output during formatter golden-output assertions. |
Makefile |
Add bench target for running benchmarks. |
.github/workflows/test.yaml |
Add a CI step to run benchmarks. |
ccoVeille
approved these changes
Feb 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logs before
Logs after