This commit adds the `goheader` rule to `golangci-lint` to enforce that
all our Go source code includes appropriate licence headers, fixing up
files that currently fail that check.
---------
Co-authored-by: Will Jones <will@sacharissa.co.uk>
The prior commit discovered that our retry logic backs off
by a longer delay than it needs to.
It doesn't respect the initial "delay" configuration,
and instead begins with "delay * backoff".
This change fixes the issue and updates the test expectations.
This extracts the core logic in the retry package into a Retryer struct.
The Retryer struct supports an optional "After" field,
which allows injecting a custom time.After implementation.
With this, we're able to write tests for this package
without actually sleeping (and slowing down the test suite).
Note that the tests exposed two surprising behaviors:
- If the context times out or expires, we correctly return `false`,
but we return a nil error instead of `ctx.Err()`.
I've chosen to not change this at this time
because we don't know what that might break downstream.
- The initial delay is never used. We start with delay*backoff.