<!---
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. -->
Fixes # (issue)
## Checklist
- [ ] I have run `make tidy` to update any new dependencies
- [ ] 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. -->
Signed-off-by: yetyear <flite@outlook.com>
As we discussed in ideation yesterday, this is the way we want to go,
and try to be consistent with it. I've also opened
https://github.com/pulumi/go-change/pull/25 to update the go-change tool
to suggest that mood.
---------
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
# Description
Add a make target to setup a go workspace. This is needed to make
`gopls`, the go language server, work seamlessly when opening the root
of the repo.
This PR implements the new policy transforms feature, which allows
policy packs to not only issue warnings and errors in response to policy
violations, but actually fix them by rewriting resource property state.
This can be used, for instance, to auto-tag resources, remove Internet
access on the fly, or apply encryption to storage, among other use
cases.
We mention that you need to install gofumpt,
but it's easy to miss that there's some editor setup involved.
gofumpt is not mentioned in the `brew install` which,
depending on editor, may be necessary.
(Editors that use gopls don't need to install it globally,
but editors that invoke it manually need it installed.)
Lastly, Submitting a PR could do with explaining the lint/gofumpt
requirements.
Ref: https://github.com/pulumi/pulumi/pull/12854#discussion_r1190467688
Pulumi supports the same versions of Go as upstream.
Instead of updating the CONTRIBUTING.md with every Go releas,
specify that contributors should install "a supported version",
which will normally be one of the two most recent minor releases.
Resolves#12664
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.
* Move PULUMI_ROOT to relative path $REPO/.bin
* Add .bin to gitignore
* Change home to $HOME/.pulumi-dev
* Cleanup nodejs/readme and remove .bin (gitignore)
We've had a few issues in the recent past related to pipenv oddities in
CI which lead us to temporarily globally install the Python SDK in CI.
This change removes the use of pipenv in favor of Python's built-in
venv and avoids globally installing the Python SDK.
As part of our continued effort to make our releases more useful,
we will be adding our CHANGELOG entries to the GitHub Release.
To make this process smooth, we are going to change things a little:
1. All new changelog entries when submitting a PR for an upcoming
release will now need to get added to CHANGELOG_PENDING.md
This is the source of information for what will be delivered in the
release.
2. When a release is being made, the entries from CHANGELOG_PENDING
will be copied to a new version and dated section in CHANGLOG to
mark the release
3. The GH tags will continue as normal and Goreleaser will copy
the changelog entries to the release section in GH
We had been using `pandoc` to convert our README.md into a README.rst
for use with `setup.py` and the python package ecosystem. It turns out
that we can use markdown if we set a content type. So let's do that
and make things a little simpler.
While I was in the area, I made the encoding of UTF-8 explicit when
opening README.md.
* Remove pulumi.io reference in tests
* Remove pulumi.io references in Dockerfiles
* Remove pulumi.io references in CONTRIBUTING.md
* Update README.md's
* Use correct logo
This commit switches from dep to Go 1.12 modules for tracking Pulumi
dependencies. Rather than _building_ using Go modules, we instead use the `go
mod vendor` command to populate a vendor tree in the same way as `dep ensure`
was previously doing.
In order to prevent checksum mismatches, it was necessary to also update CI to
use Go 1.12 instead of 1.11 - which also necessitated fixing some linting errors
which appeared with the upgraded golangci-lint for 1.12.
Instead of duplicating information about how to build Pulumi from
source in both `README.md` and `CONTRIBUTING.md`, just have the
`README.md` point at `CONTRIBUTING.md`.
Fixes#2197
We run the same suite of changes that we did on gometalinter. This
ended up catching a few new issues, some of which were addressed and
some of which were baselined.