pulumi/pkg/backend
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
..
display Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
filestate Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
httpstate Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
state [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
apply.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
apply_test.go Add more detail to update display to indicate `retainOnDelete` usage. 2023-04-05 17:25:23 -07:00
backend.go Fix destroy without project file 2023-05-02 10:36:16 +01:00
backend_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
cancellation_scope.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
errors.go Add a link to docs for the 409 Conflict error message (#3207) 2019-09-10 13:25:08 -07:00
mock.go Fix destroy without project file 2023-05-02 10:36:16 +01:00
policypack.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
query.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
snapshot.go pkg/backend: Prefer contract.Assertf over Assert 2023-02-21 15:13:16 -08:00
snapshot_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
stack.go Support 'pulumi:tags' config to set stack tags 2023-05-24 09:02:22 +01:00
updates.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
watch.go Don't pass a second SecretsProvider to backend.Watch 2023-05-08 20:38:40 +01:00