Skip to content

Commit

Permalink
Merge b55c8c1 into 7576c0a
Browse files Browse the repository at this point in the history
  • Loading branch information
guineveresaenger committed Mar 24, 2022
2 parents 7576c0a + b55c8c1 commit 72e5489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@

- [cli] - Stack names correctly take `org set-default` into account when printing.
[#9240](https://github.com/pulumi/pulumi/pull/9240)

- [codegen/go] - Fix Go SDK function output to check for errors
[pulumi-aws#1872](https://github.com/pulumi/pulumi-aws/issues/1872)
7 changes: 7 additions & 0 deletions pkg/codegen/go/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2073,11 +2073,18 @@ func ${fn}Output(ctx *pulumi.Context, args ${fn}OutputArgs, opts ...pulumi.Invok
ApplyT(func(v interface{}) (${fn}Result, error) {
args := v.(${fn}Args)
r, err := ${fn}(ctx, &args, opts...)
if err != nil {
return nil, err
}
if r == nil {
return nil, fmt.Errorf("expected either result or error to be nil, not both")
}
return *r, err
}).(${outputType})
}
`

code = strings.ReplaceAll(code, "${fn}", originalName)
code = strings.ReplaceAll(code, "${outputType}", resultTypeName)
fmt.Fprintf(w, code)
Expand Down

0 comments on commit 72e5489

Please sign in to comment.