Commit Graph

7 Commits (003ae7a5a2f0088a28798e07b012319b2868cb1f)

Author SHA1 Message Date
demoManito ae118a17f0 fix goimorts local-prefixes
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-29 13:55:47 +08:00
demoManito 0a08fa2b43 golangci: add import order check
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-29 11:30:04 +08:00
demoManito 93b9dc6583 golangci: add unconvert check
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-28 19:13:58 +08:00
Benjamin Wang 4f907e950e CI: remove hardcode go version in .golangci.yaml
The default Go version used by golinter is coming from the go.mod
file, fallback on the env var `GOVERSION`. So no need to configure
the go version in .golangci.yaml.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-18 04:04:35 +08:00
Cenk Alti f8b65d53ba
Add revive to the list of linters.
Part of "Enhance the static-analysis workflow" issue. #14164

Signed-off-by: Cenk Alti <cenkalti@gmail.com>
2022-08-27 13:41:14 -04:00
Ramsés Morales 3cdc4225e1 Followup to "Add golangci-lint config file"
Addressed comments by @ldez and added `lint-fix` target.

Signed-off-by: Ramsés Morales <ramses@gmail.com>
2022-07-28 17:55:22 -07:00
Ramsés Morales a7a48168a0 Add golangci-lint config file and `make` target.
Here we add file `.golangci.yaml`, to have a common configuration for
static analysis. If you use the following IDEs/editors, they will read
the file:

- `vim` with vim-go.
- VSCode.

The initial configuration file is based on Kubernetes' HEAD. We removed
a custom kubernetes-linter for custom kubernetes-logging. We also
changed to Golang version 1.17 (etcd's current target Golang version)
from 1.18.

Also, we added a new target to `Makefile`: `lint`. NOTE that auto-fixing
should be part of a later commit, once we are all happy with how the
configuration file is working for us.

As expected, this change fixes two issues found by this `.golangci.yaml`
in file `contrib/lock/client/client.go`:

- Dead code, removed.
- Innefective assignment, removed.

Finally, we are updating `CONTRIBUTING.md` to mention `golangci-lint`.

We will add a GitHub-action to run `golangci-lint` in a future change.

Local testing done:

- `make build`.
- `make test`.

Both are happy.

This is the initial step to fix
https://github.com/etcd-io/etcd/issues/14164.

Signed-off-by: Ramsés Morales <ramses@gmail.com>
2022-07-28 17:55:08 -07:00