pulumi/sdk/go
Abhinav Gupta 2d3a1ecc3e
plugin(go, node, py): Exit cleanly on interrupt (#13809)
This changes the language plugins for Go, Node, and Python
to watch for the os.Interrupt signal (SIGINT on Unix, CTRL_BREAK on
Windows)
that the plugin lifetime manager sends (per #13795)
and exit cleanly on receiving the signal.

This is a no-op for users.
An immediate effect it'll have for us is that
we'll begin seeing test coverage data come out of these binaries.

A similar change is necessary in other language plugin binaries.
I did not touch uses of rpcutil.ServeWithOptions outside `main` packages
because whether a signal handler should be installed there or not
requires more knowledge of individual cases.

Note that this uses [signal.NotifyContext][1].
Calling the returned `cancel()` function removes the signal handler.
This is desirable so that if a user sends the signal again
(e.g., presses Ctrl-C again), we don't capture it
and let the OS kill the process.

  [1]: https://pkg.go.dev/os/signal#NotifyContext

Refs #9780
2023-08-29 15:42:31 +00:00
..
auto deps: Upgrade google.golang.org/{genproto, grpc} 2023-07-27 16:24:33 -07:00
common resource/plugin: Shut down plugins gracefully (#13795) 2023-08-29 12:02:54 +00:00
internal sdk/go: Add pulumix subpackage (#13509) 2023-08-28 15:38:23 +00:00
pulumi sdk/go: Add pulumix subpackage (#13509) 2023-08-28 15:38:23 +00:00
pulumi-language-go plugin(go, node, py): Exit cleanly on interrupt (#13809) 2023-08-29 15:42:31 +00:00
pulumix sdk/go/pulumix: Rename SpecializeOutput to Cast (#13769) 2023-08-28 19:41:49 +00:00
Makefile [sdk/go] Fix the `dist` make target 2023-06-30 16:09:03 -07: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.