Skip to content

Preallocate slice in update_test.go#565

Merged
JamieMagee merged 1 commit intomainfrom
jamiemagee/fix-prealloc-lint
Feb 9, 2026
Merged

Preallocate slice in update_test.go#565
JamieMagee merged 1 commit intomainfrom
jamiemagee/fix-prealloc-lint

Conversation

@JamieMagee
Copy link
Member

Fixes the prealloc golangci-lint warning in update_test.go.

The actualCredentialsMetadataHosts slice was being initialized as an empty literal and grown via append in a loop over credentialsMetadataHosts. Since the map length is known at that point, we can pass it to make() and skip the reallocations.

@JamieMagee JamieMagee requested review from a team as code owners February 9, 2026 22:57
Use make() with a known capacity instead of an empty slice literal,
so the append loop doesn't have to grow the backing array.
@JamieMagee JamieMagee force-pushed the jamiemagee/fix-prealloc-lint branch from 941e6aa to 9c5a5de Compare February 9, 2026 23:52
@JamieMagee JamieMagee enabled auto-merge February 9, 2026 23:52
@JamieMagee JamieMagee added this pull request to the merge queue Feb 9, 2026
Merged via the queue into main with commit fe8b225 Feb 9, 2026
89 checks passed
@JamieMagee JamieMagee deleted the jamiemagee/fix-prealloc-lint branch February 9, 2026 23:57
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.

2 participants