chore: fix prealloc findings - #378
Merged
Merged
Conversation
sosheskaz
force-pushed
the
chore/fix-prealloc-findings
branch
from
July 30, 2026 19:08
228c0ce to
311ea2d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR re-enables the prealloc golangci-lint linter for production Go code and resolves the resulting slice preallocation findings, primarily in Object Storage HCL rendering helpers. It also increases the acceptance-test sweeper per-suite go test timeout to reduce failures during longer cleanup runs.
Changes:
- Re-enable
preallocin.golangci.yamlwhile continuing to exclude it (and other heavy linters) for*_test.gofiles. - Preallocate known-capacity
[]cty.Valueslices in Object Storage rendering helpers to satisfypreallocfindings without changing rendered output. - Increase
testacc-sweep’s per-suitego testtimeout from 10m to 30m inGNUmakefile.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
GNUmakefile |
Increases acceptance-test sweeper per-suite timeout to 30 minutes to avoid premature timeouts during long sweeps. |
coreweave/object_storage/resource_organization_access_policy.go |
Preallocates statement/action/resource/principal slices to address prealloc findings without altering rendered policy structure. |
coreweave/object_storage/data_source_bucket_policy_document.go |
Preallocates per-statement lists/maps when building cty values to satisfy prealloc and keep output identical. |
.golangci.yaml |
Re-enables prealloc globally and explicitly excludes it from test files via exclusions rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scotchneat
approved these changes
Jul 30, 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.
Re-enables
preallocfor production Go files and fixes the remaining live findings exposed by golangci-lint 2.9.0. Test files are excluded fromprealloc, and the earlier test-helper preallocation changes have been reverted.The production changes add known slice capacities in Object Storage rendering helpers without changing values, ordering, schemas, provider behavior, or exported APIs.
This PR also raises the acceptance-test sweeper's Go test timeout from 10 to 30 minutes. The previous CKS sweep exhausted the global 10-minute limit while sequentially deleting existing QA clusters.
Validation
0 issues)go test ./coreweave/cks ./coreweave/object_storagegofmt -don the restored test files*_test.gofiles match the parent branchmake -n testacc-sweep SUITES=cks TEST_ACC_SWEEP_ZONE=US-LAB-01Agit diff --checkCaveats
The nested-worktree gopls diagnostics attempt returned
no package metadata; the focused Go 1.26 tests and pinned lint run completed successfully.