pulumi/sdk/go/common/util
Will Jones c496921d44
Enable some more linting rules (#17456)
Issue #10659 lists a number of extra linting checks that we could enable
in order to make our Go code more robust. This commit implements as many
as seem sensible:

* `durationcheck`, which checks for multiplication of `time.Duration`s,
which can lead to unexpected behaviour (e.g. `time.Second * time.Second`
is *not* one second)
* `goprintffuncname`, which checks that `Printf`-like functions are
appropriately suffixed with `f` to indicate as such
* `tenv`, which checks for `os.Setenv` in tests where `t.Setenv` is
generally a better solution
* `wastedassign`, which checks for assignments whose values are never
used (such as initial values before an `if` where both branches then
overwrite the value)
* `whitespace`, which checks for blank lines at the beginning and end of
blocks such as functions, `if`s, `for`s and so on.

This commit does *not* enable the following checks listed in #10659:

* `wrapcheck`, which insists that third-party library errors are always
`%w`rapped -- we have a lot of cases where we don't do this and it's
probably a bit more involved than "just wrap them" in terms of making
sure we don't break anything (maybe)
* `predeclared`, which checks for shadowing of existing Go identifiers
-- we use `old` and `new` a lot, especially in step generation, so this
is probably a slightly bigger clean-up/one we might want to opt out of
* `mnd` (magic number detection) -- we have a lot of failures on this
* `nilnil` -- we only have a couple of failures on this; these could
probably be handled with `//nolint` but for now I've opted not to take
this route.
2024-10-03 17:37:13 +00:00
..
archive Prepare golangci-lint upgrade (#17065) 2024-08-28 07:57:38 +00:00
ciutil Use `SYSTEM_PULLREQUEST_SOURCECOMMITID` for AZ pipeline on GH PR (#15513) 2024-02-26 14:55:54 +00:00
cmdutil Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
contract sdk/contract: Deprecate non-f variants 2023-03-03 14:37:59 -08:00
deepcopy disallow OutputState to be deepcopied (#16690) 2024-07-18 12:56:36 +00:00
env Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
executable Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
fsutil Install missing python versions using pyenv during installation (#16855) 2024-08-19 15:55:54 +00:00
gitutil Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
httputil retry post requests that timeout during handshake (#16576) 2024-07-03 16:22:24 +00:00
logging Use the Depth variants in glog calls (#15307) 2024-01-29 22:51:45 +00:00
mapper turn on the golangci-lint exhaustive linter (#15028) 2024-01-17 16:50:41 +00:00
result Replace `result.Result` with native errors (#17044) 2024-08-22 14:39:59 +00:00
retry Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
rpcutil Replace pkg/errors.Wrap with fmt.Errorf (#17201) 2024-09-09 11:11:46 +00:00
yamlutil Preserve ordering when editing stack config. (#17452) 2024-10-02 13:31:10 +00:00