Skip to content

refactor: optimize slice allocations and meta checks - #655

Merged
tenthirtyam merged 2 commits into
mainfrom
refactor/optimize-slice-allocations-and-meta-checks
Jun 22, 2026
Merged

refactor: optimize slice allocations and meta checks#655
tenthirtyam merged 2 commits into
mainfrom
refactor/optimize-slice-allocations-and-meta-checks

Conversation

@tenthirtyam

Copy link
Copy Markdown
Contributor

Summary

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.

Type

  • This is a bug fix.
  • This is an enhancement or feature.
  • This is a code style/formatting update.
  • This is a documentation update.
  • This is a refactoring update.
  • This is a chore update
  • This is something else.
    Please describe:

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

Test and Documentation

  • Tests have been completed.
  • Documentation has been added or updated.

Issue References

Additional Information

@tenthirtyam tenthirtyam self-assigned this Jun 19, 2026
@tenthirtyam tenthirtyam added the refactor Refactor label Jun 19, 2026
@github-actions github-actions Bot added provider Provider needs-review Needs Review labels Jun 19, 2026
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
tenthirtyam force-pushed the refactor/optimize-slice-allocations-and-meta-checks branch from b24fd9e to 24a4919 Compare June 22, 2026 19:04
@tenthirtyam

Copy link
Copy Markdown
Contributor Author

@vivgoyal I've rebased this branch and the CI is failing with two remaining staticcheck items that I'll address with an update soon to clear the CI.

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>
@tenthirtyam

Copy link
Copy Markdown
Contributor Author

@vivgoyal I've rebased this branch and the CI is failing with two remaining staticcheck items that I'll address with an update soon to clear the CI.

@vivgoyal This was resolved in a015f09 and the CI is now passing the linting once again.

@tenthirtyam
tenthirtyam merged commit 1ef8486 into main Jun 22, 2026
8 checks passed
@tenthirtyam
tenthirtyam deleted the refactor/optimize-slice-allocations-and-meta-checks branch June 22, 2026 20:47
@tenthirtyam tenthirtyam removed the needs-review Needs Review label Jun 22, 2026
@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

provider Provider refactor Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants