pulumi/sdk/go
Thomas Gummerer f6f2c5db1c
fix race condition in tail better (#18066)
In https://github.com/pulumi/pulumi/pull/18044 we vendored the
nxadm/tail library and pulled in a couple of changes from upstream to
avoid race conditions.

However the changes from upstream were not sufficient. Namely, one of
the changes was to try and avoid exiting early if tail is meant to stop
at the next EOF. It did so by setting the earlyExitChan to `nil` if tail
was requested to shut down with a stopAtEOF error. However it is
possible that stopAtEOF is written to the earlyExitChan after we checked
`tail.Err()`, but before we get to the select.

In that case we can still get an early exit on EOF, which we don't want.
Move the check for the stopAtEOF error into the earlyExitChan case. At
this point tail.Err() is guaranteed to be set correctly, if the user
requested a stop at eof.

Also fix a separate race in the test, where the test called `Stop()`
twice, which was incorrect and unnecessary.

(This unflaked the test `TestFollowUntilEof` locally for me. Using `go
test -run TestFollowUntilEof\$ -count 10000 .` would fail pretty
consistently after a couple of time max. With this change running it in
a loop doesn't seem to break it anymore)

This requires no separate changelog entry since
https://github.com/pulumi/pulumi/pull/18044 was not released yet.

---------

Co-authored-by: Will Jones <will@sacharissa.co.uk>
2024-12-18 12:10:53 +00:00
..
auto fix race conditions in nxadm/tail library (#18044) 2024-12-16 14:32:08 +00:00
common fix race condition in tail better (#18066) 2024-12-18 12:10:53 +00:00
internal Add OutputWithDependencies (#17856) 2024-11-26 09:53:24 +00:00
property Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
pulumi Return when rejecting the InvokeOutput output on error (#18010) 2024-12-11 18:25:01 +00:00
pulumi-internal/netutil try to choose a consistent port for debugging (#17271) 2024-09-18 10:06:17 +00:00
pulumi-language-go fix race conditions in nxadm/tail library (#18044) 2024-12-16 14:32:08 +00:00
pulumix Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +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.