Commit Graph

5 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
Kyle Dixler e8d68a7e8b
Fix docs conflict between module, resource, and function with the same
name.

Docs URLs are case-insensitive so modules, functions and resources may have
name collisions. If a filename is taken by another class of document, it
will be prefixed with "mod", "res", "fn" and docs will point to this new
unique link.

The priority is as follows:
1. module
2. resource
3. function
2023-03-29 13:00:14 -07:00
Ian Wahbe 272c4643b2
Update error handling ()
This is the result of a change applied via `go-rewrap-errors`.
2021-11-12 18:37:17 -08:00
Praneet Loke d73c380bef
[codegen/docs] Sort the package tree items ()
* Sort the modules, resources and functions individually as the package tree is created

* Update package tree test
2021-10-19 15:21:39 -07:00
Praneet Loke 8f89ab6e3a
[codegen/docs] Generate a package tree that can be serialized as JSON ()
* Add an initialize func. Add a new func that generates the package tree
2021-09-30 17:35:44 -07:00