pulumi/sdk/go/pulumi-language-go
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
..
testdata/sample fix(host/go): Allow Pulumi program in a subdir of the module 2023-05-17 13:20:38 -07:00
go.mod chore: post-release go.mod updates 2023-06-22 21:48:48 +00:00
go.sum cli(state upgrade): Prompt for project names for detached stacks 2023-06-22 13:45:13 -07:00
main.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
main_test.go Test components in convert 2023-06-01 20:54:44 +01:00