pulumi/sdk/go/common
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
..
apitype [apitype] Add RetainOnDelete to StepEventStateMetadata 2023-06-26 12:50:39 -07:00
constant Send update metadata about update plans 2022-10-12 22:55:59 +01:00
diag [sdk] Update uniseg 2023-05-25 22:24:13 -07:00
display Moving previewDigest to sdk/go/common/display, and exporting it. (#9886) 2022-06-27 09:08:06 -05:00
encoding all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
env filestate: Support opting into legacy layout 2023-03-31 13:21:37 -07:00
resource Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
slice Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
testing address comments: use os.UserHomeDir() and disable parallel tests 2023-06-26 13:53:58 +02:00
tokens sdk/go: Add tokens.ValidateProjectName 2023-06-13 10:08:31 -07:00
tools all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
util Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
version move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00
workspace Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00