pulumi/pkg/backend/filestate
Fraser Waters 571fadae3f Use slice.Prealloc instead of make([]T, 0, ...)
Fixes https://github.com/pulumi/pulumi/issues/12738

https://github.com/pulumi/pulumi/pull/11834 turned on the prealloc
linter and changed a load of slice uses from just `var x T[]` to `x :=
make([]T, 0, preallocSize)`. This was good for performance but it turns
out there are a number of places in the codebase that treat a `nil`
slice as semnatically different to an empty slice.

Trying to test that, or even reason that through for every callsite is
untractable, so this PR replaces all expressions of the form `make([]T,
0, size)` with a call to `slice.Prealloc[T](size)`. When size is 0 that
returns a nil array, rather than an empty array.
2023-06-29 11:27:50 +01:00
..
backend.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
backend_legacy_test.go pkg/filestate: Plumb context 2023-04-10 15:53:32 -07:00
backend_test.go Fix auto-opt-in for local project stacks 2023-06-22 13:36:52 +01:00
bucket.go pkg/filestate: Plumb context 2023-04-10 15:53:32 -07:00
bucket_test.go pkg/filestate: Plumb context 2023-04-10 15:53:32 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
lock.go pkg/filestate: Plumb context 2023-04-10 15:53:32 -07:00
meta.go Fix auto-opt-in for local project stacks 2023-06-22 13:36:52 +01:00
meta_test.go Fix auto-opt-in for local project stacks 2023-06-22 13:36:52 +01:00
pool.go filestate: Add re-usable worker pool 2023-06-12 09:20:26 -07:00
pool_test.go filestate: Add re-usable worker pool 2023-06-12 09:20:26 -07:00
snapshot.go pkg/filestate: Plumb context 2023-04-10 15:53:32 -07:00
stack.go Make filestate.Snapshot lazy like httpstate 2023-05-24 08:24:04 +01:00
state.go Fix auto-opt-in for local project stacks 2023-06-22 13:36:52 +01:00
store.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
store_test.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00