From 85fa44504f40a8f310f27b393069376055ec27e6 Mon Sep 17 00:00:00 2001 From: aq17 Date: Mon, 5 Dec 2022 13:48:45 -0800 Subject: [PATCH] Add *[TYPE] to [TYPE]ptr methods --- ...cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml | 4 ++++ sdk/go/pulumi/generate/templates/types_builtins.go.template | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml diff --git a/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml b/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml new file mode 100644 index 000000000000..98064d91c897 --- /dev/null +++ b/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml @@ -0,0 +1,4 @@ +changes: +- type: feat + scope: sdk + description: Add methods to cast pointer types to corresponding Pulumi Ptr types diff --git a/sdk/go/pulumi/generate/templates/types_builtins.go.template b/sdk/go/pulumi/generate/templates/types_builtins.go.template index 0777ad28c864..e3a8985738df 100644 --- a/sdk/go/pulumi/generate/templates/types_builtins.go.template +++ b/sdk/go/pulumi/generate/templates/types_builtins.go.template @@ -47,6 +47,11 @@ type {{.PtrType}} {{.ElemElementType}} func {{.Name}}(v {{.ElemElementType}}) {{.Name}}Input { return ({{.InputType}})(&v) } +{{if .ImplementsPtrType}} +func {{.Name}}(v *{{.ElemElementType}}) {{.Name}}Input { + return ({{.InputType}})(v) +} +{{end}} {{end}} {{if .DefineInputMethods}} // ElementType returns the element type of this Input ({{.ElementType}}).