refactor: optimize slice allocations and meta checks - #655
Merged
tenthirtyam merged 2 commits intoJun 22, 2026
Conversation
Preallocate slice capacities and consolidate meta check appends across the codebase to reduce allocations, clarify test check composition, and resolve golangci-lint errors in the GitHub Actions CI runs. Changes include preallocating error/slice capacities, replacing repeated make([]T,0) with capacity-aware makes (many mock tests use capacity 1 for reference arrays), and refactoring test check builders to use a metaChecks variable and a single composed slice before calling `resource.ComposeTestCheckFunc`. Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
tenthirtyam
force-pushed
the
refactor/optimize-slice-allocations-and-meta-checks
branch
from
June 22, 2026 19:04
b24fd9e to
24a4919
Compare
Contributor
Author
|
@vivgoyal I've rebased this branch and the CI is failing with two remaining |
Removed empty if blocks in `checkNetworkPolicyResourceAttributes` and
`verifyNetworkPolicyResourceCreation` that looked up `ENABLE_POLICY_ENV_TEST` but had no body. The checks were no-ops and triggered staticcheck SA4006 ("this value of found is never used"). Inline the workspace name directly, matching the pattern used in other policy acceptance tests.
No test behavior changes.
Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
Contributor
Author
vivgoyal
approved these changes
Jun 22, 2026
gurav-samir
approved these changes
Jun 22, 2026
tenthirtyam
deleted the
refactor/optimize-slice-allocations-and-meta-checks
branch
June 22, 2026 20:47
|
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Preallocate slice capacities and consolidate meta check appends across the codebase to reduce allocations, clarify test check composition, and resolve
golangci-linterrors in the GitHub Actions CI runs.Changes include preallocating error/slice capacities, replacing repeated make([]T,0) with capacity-aware makes (many mock tests use capacity 1 for reference arrays), and refactoring test check builders to use a metaChecks variable and a single composed slice before calling
resource.ComposeTestCheckFunc.Type
Please describe:
Breaking Changes?
Test and Documentation
Issue References
Additional Information