docs(go): add a conceptual overview of inputs and outputs in Go#18856
docs(go): add a conceptual overview of inputs and outputs in Go#18856joeduffy wants to merge 4 commits into
Conversation
Add a new Go-specific page that explains the Pulumi Go SDK's input/output type system in depth. The language-neutral inputs-outputs concepts page includes multi-language examples for Go, but it does not cover Go-specific details like the typed wrapper output hierarchy, the ApplyT function, output lifting, and the ToXxxOutput() conversion pattern. This page covers: - Input helper constructors (pulumi.String, pulumi.Int, etc.) and Ptr variants - Collection input types (pulumi.StringArray, pulumi.StringMap, etc.) - Typed output wrappers (pulumi.StringOutput, pulumi.IntOutput, etc.) - Transforming outputs with ApplyT and ApplyTWithContext - Combining multiple outputs with pulumi.All - The ToXxxOutput() conversion for Input-to-Output in component constructors - Output lifting with generated Index/accessor methods - String formatting with pulumi.Sprintf - Exporting stack outputs with ctx.Export - Common pitfalls (missing type assertions, creating resources in ApplyT, etc.) Also updates the Go language SDK index page to link to this new page. Fixes #11762
Docs reviewSolid, well-structured page that fills a real gap in the Go SDK docs. A few things to address before merging. Style — heading and menu casingPer
Suggested fix: Technical accuracy — pointer helper commentsLines 39–42: pulumi.StringPtr(\"optional-value\") // *string
pulumi.IntPtr(8080) // *int
pulumi.BoolPtr(false) // *bool
pulumi.Float64Ptr(1.5) // *float64
Relatedly, line 45 says "the pointer helpers are typically needed when a resource argument is typed as
Technical accuracy — "Nil receivers" pitfallLine 256:
This claim is unusual and worth verifying against the actual SDK behavior before publishing. Minor
What's good
@claude — let me know if you'd like another pass after edits. |
- Title/h1/menu: use Title Case per AGENTS.md - Ptr helper comments: use pulumi.XxxPtrInput not *string - Reword pointer helpers explanation - Remove unverified nil receivers claim - Trim meta_desc to < 160 chars - Remove unnecessary alias
Summary
This PR adds a new Go-specific documentation page explaining how Pulumi's input and output type system works in Go. The existing language-neutral Inputs & outputs page includes Go code examples, but does not address the aspects of the Go SDK that are unique to the language—the typed wrapper hierarchy, the
ApplyTfunction, output lifting, and theToXxxOutput()conversion pattern. Issue #11762 (filed by @lukehoban) and a follow-on community comment called these areas out as gaps.What's new
New page:
content/docs/iac/languages-sdks/go/go-inputs-outputs.mdAppears in the navigation as "Inputs & outputs" under the Go language SDK section. Covers:
pulumi.String,pulumi.Int,pulumi.StringPtr, etc.)pulumi.StringArray,pulumi.StringMap, etc.)pulumi.StringOutput,pulumi.IntOutput, etc.) and why Go uses concrete types rather than a genericOutput<T>ApplyTandApplyTWithContext, including the required type assertion patternpulumi.AllInputtoOutputwithToXxxOutput()(essential for component constructors)Index()/accessor methods on structured output typespulumi.Sprintfctx.ExportUpdated page:
content/docs/iac/languages-sdks/go/_index.mdThe existing paragraph referencing the general Inputs & outputs page now also links to the new Go-specific page.
Navigation
The page is wired into the
iacmenu underiac-languages-goat weight 3, so it appears as the first sub-page under the Go language SDK entry.Fixes #11762
🧠 This PR was created by workprentice on behalf of @joeduffy.