mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14255 from ramses/golangci-config
Add golangci-lint config file and `make` target.
This commit is contained in:
commit
046c46e52e
37
.golangci.yaml
Normal file
37
.golangci.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
run:
|
||||
go: '1.17'
|
||||
timeout: 30m
|
||||
skip-files:
|
||||
- "^zz_generated.*"
|
||||
|
||||
issues:
|
||||
max-same-issues: 0
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
exclude-rules:
|
||||
# exclude ineffassing linter for generated files for conversion
|
||||
- path: conversion\.go
|
||||
linters:
|
||||
- ineffassign
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable: # please keep this alphabetized
|
||||
# Don't use soon to deprecated[1] linters that lead to false
|
||||
# https://github.com/golangci/golangci-lint/issues/1841
|
||||
# - deadcode
|
||||
# - structcheck
|
||||
# - varcheck
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- stylecheck
|
||||
- unused
|
||||
|
||||
linters-settings: # please keep this alphabetized
|
||||
staticcheck:
|
||||
checks:
|
||||
- "all"
|
||||
- "-SA1019" # TODO(fix) Using a deprecated function, variable, constant or field
|
||||
- "-SA2002" # TODO(fix) Called testing.T.FailNow or SkipNow in a goroutine, which isn’t allowed
|
||||
stylecheck:
|
||||
checks:
|
||||
- "ST1019" # Importing the same package multiple times.
|
@ -92,3 +92,9 @@ commit using message with a more generic `*:` prefix.
|
||||
*: <what changed>
|
||||
[..]
|
||||
```
|
||||
|
||||
### Static analysis.
|
||||
|
||||
We recommend that you install [golangci-lint](https://golangci-lint.run/usage/install/) and run `make lint`.
|
||||
|
||||
Very soon we will have a GitHub action to run our linters.
|
||||
|
8
Makefile
8
Makefile
@ -166,3 +166,11 @@ build-docker-release-main:
|
||||
push-docker-release-main:
|
||||
$(info ETCD_VERSION: $(ETCD_VERSION))
|
||||
docker push gcr.io/etcd-development/etcd:$(ETCD_VERSION)
|
||||
|
||||
# Recursively analyzes the tree:
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
# Fixes found issues, if supported by the linter:
|
||||
lint-fix:
|
||||
golangci-lint run --fix
|
||||
|
@ -30,7 +30,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.etcd.io/etcd/client/v3"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"go.etcd.io/etcd/client/v3/concurrency"
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user