Turn on the golangci-lint exhaustive linter. This is the first step
towards catching more missing cases during development rather than
in tests, or in production.
This might be best reviewed commit-by-commit, as the first commit turns
on the linter with the `default-signifies-exhaustive: true` option set,
which requires a lot less changes in the current codebase.
I think it's probably worth doing the second commit as well, as that
will get us the real benefits, even though we end up with a little bit
more churn. However it means all the `switch` statements are covered,
which isn't the case after the first commit, since we do have a lot of
`default` statements that just call `assert.Fail`.
Fixes#14601
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
fixes fulfillValue error when joining a nil output state
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
Error can be reproduced using
https://github.com/mheers/pulumi-azure-app-reg-helm-go-error
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
`TestPulumixIsUpToDate` verifies the code in pulumix is up-to-date, but
the generated code includes a copyright range including the current
year, which now fails because of 2024. This commit pins the copyright
date in the template to 2023.
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is a pass over all of /sdk to replace asserts that just checked we
had an error with asserts for what the error value is.
Just checking for an error is a weak test that can result in error paths
being broken and tests not detecting it.
**Each commit is separately reviewable.**
---
Adds the pulumix subpackage implementing strongly-typed
inputs, outputs, and combinators.
internal/cmd/gen-pux-applyn generates all four variants of `Apply` for
up to 8 parameters.
See individual commits for more details on each change.
Resolves#13586
**Note to reviewers**:
GitHub's PR view will show a lot more for this change
than the actual code added/removed.
Consider opening a `git diff` of this with,
git diff -C --diff-algorithm=minimal
This will correctly detect the bulk of the diff as
"copy a file and delete a bunch of stuff from it."
---
In preparation for implementing generic variants of Input and Output
in a pulumix subpackage, move some of the requisite types to internal/
so that we don't have a cyclic dependency between pulumi and pulumix.
This change is largely mechanical with adjustmenets made for
compilation.
For places in pulumi/ where internal state of an output was accessed,
new top-level functions were added to internal/
that expose this information.
Changes were noting explicitly:
- `OutputState` was changed to record dependencies as `[]internal.Resource`
instead of `[]Resource` because moving `Resource` into internal
will end up moving most of pulumi/ into internal.
We cast to/from internal.Resource as needed.
- `internal.AnyOutputType` is a `reflect.Type` filled by sdk/go/pulumi
at `init()` time.
This is an annoying hack, but we can't move AnyOutput into internal.
- `internal.FullyResolvedTypes` is similarly filled by sdk/go/pulumi
at `init()` time.
To add confidence to this change being safe,
I used [apidiff] to compare the API of the go/pulumi package
befor and after this change.
The command reported no changes.
[apidiff]: https://pkg.go.dev/golang.org/x/exp@v0.0.0-20230713183714-613f0c0eb8a1/cmd/apidiff
On top of that, I also ran `go doc -all .` with the before/after
and ran a text diff on the result. The following changes were reported:
- `Input` is now an alias to `internal.Input`
- `Output` is now an alias to `internal.Output`
- `OutputState` is now an alias to `internal.OutputState`
- `OutputState.ApplyT`, `OutputState.ApplyTWithContext` were deleted
(except they're present on the alias so they're still available)
- `Resource` now embeds `internal.Resource`
Resolves#13585