pulumi/sdk/go
Will Jones 1be4888f7d
Replace `result.Result` with native errors (#17044)
`result.Result` is a type that was introduced to enable us to
distinguish between *expected* errors (or *bails* in Pulumi parlance)
and *unexpected* errors or exceptions. Prior to Go 1.13, this made a lot
of sense, since there was no standard story on "wrapping" errors, and
thus no way to answer the question "did I end up here (in an error path)
because I meant to, or did I end up here because of a program bug?".

With the introduction of `%w`, `interface { Unwrap() []error }` and
company in Go 1.13, a simpler interface is available: one can use
`errors.Is` and `errors.As` to ask if an error at any point wraps an
error of a certain type. With this, we can simply ask "is there a bail
at any point in this error tree?" rather than having to track this
explicitly using a type such as `result.Result`. The `IsBail` function
was introduced a while ago to this end, but its rollout was not
completed and several uses of `result.Result` remained.

This commit completes the rollout of this simplified interface,
replacing all uses of `result.Result` with native Go errors that may or
may not wrap bails, and all uses of e.g. `res.IsBail` with
`IsBail(err)`. Doing so allows us to remove `result.Result` entirely.
2024-08-22 14:39:59 +00:00
..
auto Add options to automation API Workspace.Install (#16888) 2024-08-20 10:06:33 +00:00
common Replace `result.Result` with native errors (#17044) 2024-08-22 14:39:59 +00:00
internal turn on the golangci-lint exhaustive linter (#15028) 2024-01-17 16:50:41 +00:00
property Property map keys are just strings (#15767) 2024-03-25 17:26:41 +00:00
pulumi unmarshal pointers correctly if destination type is any (#16914) 2024-08-19 14:43:31 +00:00
pulumi-language-go Add an `organization` intrinsic to PCL (#16948) 2024-08-19 03:58:19 +00:00
pulumix Use EqualError/ErrorContains instead of Error (#14737) 2023-12-08 06:40:14 +00:00
Makefile sdk/go: fix test_fast Makefile target (#16811) 2024-07-26 10:25:04 +00:00
README.md `pulumi update` => `pulumi up` (#2702) 2019-05-06 14:00:18 -07:00

README.md

Pulumi Golang SDK

This directory contains support for writing Pulumi programs in the Go language. There are two aspects to this:

  • pulumi/ contains the client language bindings Pulumi program's code directly against;
  • pulumi-language-go/ contains the language host plugin that the Pulumi engine uses to orchestrate updates.

To author a Pulumi program in Go, simply say so in your Pulumi.yaml

name: <my-project>
runtime: go

and ensure you have pulumi-language-go on your path (it is distributed in the Pulumi download automatically).

By default, the language plugin will use your project's name, <my-project>, as the executable that it loads. This too must be on your path for the language provider to load it when you run pulumi preview or pulumi up.