pulumi/pkg/backend/display
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
..
internal/terminal [cli] Add an "open in browser" keybinding 2023-03-09 15:52:13 -08:00
testdata Fix diff display partially parsing JSON/YAML 2023-06-22 09:31:10 +01:00
diff.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
diff_test.go CLI update summary now shows after non-mandatory policy events seen. 2023-06-20 13:28:01 -07:00
display.go display: Switch "Open in Browser" to "View in Browser" 2023-03-10 10:52:43 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
events.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
events_test.go This commit colorizes nodejs stack traces to respect the default 2023-02-16 14:20:42 -08:00
json.go This commit adds the `Created` and `Modified` timestamps to pulumi state that are optional. 2023-03-27 09:28:26 -07:00
jsonmessage.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
object_diff.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
object_diff_test.go Fix diff display partially parsing JSON/YAML 2023-06-22 09:31:10 +01:00
options.go [cli] Abstract out terminal interactions 2022-11-08 17:13:56 -08:00
progress.go Print update summary in preview even if there are diagnostics. 2023-06-23 15:14:30 -07:00
progress_test.go Print update summary in preview even if there are diagnostics. 2023-06-23 15:14:30 -07:00
query.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
rows.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
sigint_unix.go [cli] Reimplement the interactive renderer 2022-11-07 22:02:44 -08:00
sigint_windows.go [cli] Reimplement the interactive renderer 2022-11-07 22:02:44 -08:00
tableutil.go [color] Use graphemes to measure strings. 2022-11-09 08:23:00 -08:00
tree.go Fixed panic in display on terminals with few rows and columns. 2023-03-30 16:16:48 -07:00
tree_test.go Fixed panic in display on terminals with few rows and columns. 2023-03-30 16:16:48 -07:00
watch.go [cli] Add a replay-events debug command. (#9271) 2022-04-07 09:03:19 -07:00