<!---
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 isn't quite enough for dotnet conformance to pass on everything
yet, but it's a start and gets the L1 programs passing.
## 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
- [ ] 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. -->
Per team discussion, switching to gofumpt.
[gofumpt][1] is an alternative, stricter alternative to gofmt.
It addresses other stylistic concerns that gofmt doesn't yet cover.
[1]: https://github.com/mvdan/gofumpt
See the full list of [Added rules][2], but it includes:
- Dropping empty lines around function bodies
- Dropping unnecessary variable grouping when there's only one variable
- Ensuring an empty line between multi-line functions
- simplification (`-s` in gofmt) is always enabled
- Ensuring multi-line function signatures end with
`) {` on a separate line.
[2]: https://github.com/mvdan/gofumpt#Added-rules
gofumpt is stricter, but there's no lock-in.
All gofumpt output is valid gofmt output,
so if we decide we don't like it, it's easy to switch back
without any code changes.
gofumpt support is built into the tooling we use for development
so this won't change development workflows.
- golangci-lint includes a gofumpt check (enabled in this PR)
- gopls, the LSP for Go, includes a gofumpt option
(see [installation instrutions][3])
[3]: https://github.com/mvdan/gofumpt#installation
This change was generated by running:
```bash
gofumpt -w $(rg --files -g '*.go' | rg -v testdata | rg -v compilation_error)
```
The following files were manually tweaked afterwards:
- pkg/cmd/pulumi/stack_change_secrets_provider.go:
one of the lines overflowed and had comments in an inconvenient place
- pkg/cmd/pulumi/destroy.go:
`var x T = y` where `T` wasn't necessary
- pkg/cmd/pulumi/policy_new.go:
long line because of error message
- pkg/backend/snapshot_test.go:
long line trying to assign three variables in the same assignment
I have included mention of gofumpt in the CONTRIBUTING.md.
* Add version (when env var is set)
* Correct python pypi implementation
* Add a test
* Update CHANGELOG_PENDING.md
* Set as language option
* Remove version.txt from .gitignore
* Add go support
* Correctly handle nodejs.pluginVersion
* Rebase 5758 .NET work and make output-funcs pass
* Propagate changes to the other examples
* CHANGELOG
* Address PR feedback
* Add a test reproducing aws-native compilation failure
* Fix dangling type ref issue in the .NET backend for codegen
* Accept changes and unskip simple-methods-schema compile check
* Accept changes in node, python, go codegen
* SDK changes to enable a better implementation approach
* Switch approach to support functions like GetAmiIds; avoid name conflicts under tfbridge20
* Make all dotnet tests pass, mechanical fixes + accept test output
* Accept python changes
* Accept node output
* Accept docs changes
* Deepen the unit test to cover the interesting helper type
* Accept go changes and fixup tests
* Implement dep propagation through Invoke
* Fixup cyclic-types
* Accept codegen
* NOTE we now require .NET SDK 3.15 or higher
* Multi-pass, in-place checks for SDK codegen tests; toward working Python checks
* Remove temp debug output
* Upgrade Node
* Update dotnet; need to follow up on version.txt quirks
* WIP
* Sounds like we can use non-github package names to ensure things are local
* Fix simple-enum-schema
* Fix dash-named-schema
* Fix nested-module
* Start building a test-running pass
* Infer skipping tests from skipping compiles
* Move tree schma tests to a proper place
* Address lint issues on Go code
* Build against local Go SDK
* Update pkg/codegen/internal/test/sdk_driver.go
Co-authored-by: Ian Wahbe <ian@wahbe.com>
* Make go tests work by copying them into the tree from go-extras
* Fix lint
* Fix bad merge
* Manifest-based file discovery
* Remove version-related TODO from dotnet codegen
* Add doc comment
* Do not overwrite go.mod if found from mixins
* Accept python codegen change
* Accept node codegen
* Ignore lint issue
* Accept docs changes
Co-authored-by: Ian Wahbe <ian@wahbe.com>
We run the best static check we can on generated code, ensuring that it is valid.
* Run type checker against all languages (not docs)
* Fix package location, add some deps for schemas
* More tests passing
* These tests finally work
* Make linter happy
* Fix tests for merge from master
* Opt out of input-collision(nodejs) test
* Get more visibility into testing nodejs
* Fix type assumption
* Specify ts-node version
* Retrofit typescript dependencies for node14
* Give each go instance it's own module
* Attempt to diagnose remote go mod init failure
* Provide root for go mod init
* Make linter happy
The inputs and expected outputs for the tests are encoded using a
schema. Each property present in the schema forms a testcase; the
expected outputs for each language are stored in each property's
`Language` field with the language name "test". Expected outputs can be
regenerated using `PULUMI_ACCEPT`.
Rather than duplicating the list of tests and codegen driver across each
SDK, move its definition into `pkg/codegen/internal/test`. This has a
few notable benefits:
- All SDK code generators will be tested against each test. Though some
tests may exercise a particular code generator more than others, the
extra coverage will be generally beneficial.
- Adding a new test is simpler, as only a single file needs to be
changed.
- All SDKs now honor the `PULUMI_ACCEPT` environment variable for
updating baselines.
- Codegen tests now validate all generated files instead of only a
particular subset.
These changes support arbitrary combinations of input + plain types
within a schema. Handling plain types at the property level was not
sufficient to support such combinations. Reifying these types
required updating quite a bit of code. This is likely to have caused
some temporary complications, but should eventually lead to
substantial simplification in the SDK and program code generators.
With the new design, input and optional types are explicit in the schema
type system. Optionals will only appear at the outermost level of a type
(i.e. Input<Optional<>>, Array<Optional<>>, etc. will not occur). In
addition to explicit input types, each object type now has a "plain"
shape and an "input" shape. The former uses only plain types; the latter
uses input shapes wherever a plain type is not specified. Plain types
are indicated in the schema by setting the "plain" property of a type spec
to true.
In Go, resource types are modeled as pointers, but there were cases where the type was not being emitted as a pointer, leading to panics and marshaling errors in programs. Additionally, array and map values that are external references were being emitted as pointers, but only resources should be pointers (not types), regardless of whether the resource type is external or local.
This change adds schema and codegen support for plain properties which
are emitted typed as the plain type rather than wrapped as an `Input`.
Plain properties require a prompt value and do not accept a value that
is `Output`.