pulumi/pkg/codegen/pcl
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
..
binder.go Prefer output-versioned invokes in generated programs for nodejs and python 2023-06-23 02:42:18 +02:00
binder_component.go Prefer output-versioned invokes in generated programs for nodejs and python 2023-06-23 02:42:18 +02:00
binder_nodes.go Allow null literal as a default value for config variables 2023-05-04 00:38:38 +02:00
binder_resource.go Implement lenient traversal for resources 2023-06-20 13:50:18 +02:00
binder_resource_test.go pcl/options: Support retainOnDelete 2023-03-03 10:29:59 -08:00
binder_schema.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
binder_schema_test.go all: Assert => Assertf 2023-03-03 14:37:43 -08:00
binder_test.go Implement lenient traversal for resources 2023-06-20 13:50:18 +02:00
component.go Fix panic on component type traversal 2023-05-04 17:02:38 +02:00
config.go Implement description as comments or docstring for config variables in program-gen 2023-03-21 15:01:16 +01:00
diagnostics.go Extend SkipResourceTypechecking to allow generating unknown resources 2023-06-14 19:02:56 +02:00
functions.go Fixes range scoping for PCL components 2023-06-08 21:43:54 +02:00
functions_test.go lint 2023-05-25 22:16:00 +02:00
intrinsics.go all: Assert => Assertf 2023-03-03 14:37:43 -08:00
invoke.go Prefer output-versioned invokes in generated programs for nodejs and python 2023-06-23 02:42:18 +02:00
local.go Do not panic when the type of PCL local variable isn't known 2023-04-13 20:05:16 +02:00
output.go codegen: preserve externally visible names of a resources and outputs (#9464) 2022-04-25 15:07:25 -07:00
program.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
resource.go Implement lenient traversal for resources 2023-06-20 13:50:18 +02:00
rewrite_apply.go Support range expressions that are of type output 2023-04-26 20:00:32 +02:00
rewrite_apply_test.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
rewrite_convert.go Fixes panic when trying to convert a null literal to a string value 2023-06-09 12:52:10 +02:00
rewrite_convert_test.go Fixes panic when generating go from pulumi yaml (#10047) 2022-07-07 13:15:47 -07:00
rewrite_properties.go all: Assert => Assertf 2023-03-03 14:37:43 -08:00
type.go [codegen] simplify opaque types to string newtype (#9770) 2022-06-13 11:13:03 -07:00
utilities.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
utilities_test.go lint 2023-05-25 22:16:00 +02:00