Commit Graph

7 Commits

Author SHA1 Message Date
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
Ian Wahbe cf8e8f1daf Revert "Revert "Go and Python codegen support symbols with hyphens in their names""
This reverts commit aaf547e6eb.
2022-10-17 09:37:07 -07:00
Ian Wahbe aaf547e6eb Revert "Go and Python codegen support symbols with hyphens in their names" 2022-10-14 17:07:46 -07:00
Ian Wahbe 498c34b2b1 ToUppercaseFirst handle unicode 2022-10-10 12:44:04 -07:00
Matthew Olenik 627562a65e Fix tests 2022-10-10 12:26:21 -07:00
Matthew Olenik 6904f668be PR feedback, add programgen test case 2022-10-10 12:26:18 -07:00
Matthew Olenik 5c8436656e Go and Python codegen support symbols with hyphens in their names
Previously codegen would output hyphens into the names of symbols such
as functions, variable names, etc. This fix converts hyphens to
underscores, making them valid code in Go and Python.
2022-10-10 12:25:49 -07:00