-
Notifications
You must be signed in to change notification settings - Fork 219
/
.golangci.yml
90 lines (81 loc) · 2.99 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Full list of configuration options: https://golangci-lint.run/usage/configuration/
run:
timeout: 5m
skip-dirs:
- component/pyroscope/scrape/internal/fastdelta
- component/pyroscope/scrape/internal/pproflite
output:
sort-results: true
linters:
enable:
- errcheck # Report unchecked errors
- goconst # Find repeated strings that could be replaced by constant
- gofmt # Check whether code was gofmt-ed
- goimports # Check imports were formatted with gofmt
- revive # Broad set of rules; replaces deprecated golint
- gosimple # Check whether code can be simplified
- ineffassign # Detect when assignment to variable is never used
- misspell # Report on commonly misspelled English words
- unconvert # Remove unnecessary type conversions
- unparam # Detect unused function parameters
- govet # `go vet`
- unused # Detect unused constants/variables/functions/types
- typecheck # Ensure code typechecks
- depguard # Allow/denylist specific imports
- makezero # Detect misuse of make with non-zero length and append
- tenv # Use testing.(*T).Setenv instead of os.Setenv
- whitespace # Report unnecessary blank lines
issues:
# We want to use our own exclusion rules and ignore all the defaults.
exclude-use-default: false
exclude-rules:
# It's fine if tests ignore errors.
- path: _test.go
linters:
- errcheck
exclude:
# Ignoring errors on Close, Log, and removing files is OK in most cases.
- "Error return value of `(.*\\.Close|.*\\.Log|os.Remove)` is not checked"
# Packages for integrations are named matching their upstream counterpart,
# which almost always have underscores.
- "var-naming: don't use an underscore in package name"
# Linter settings options: https://golangci-lint.run/usage/linters/
linters-settings:
depguard:
rules:
main:
deny:
- pkg: "sync/atomic"
desc: Use go.uber.org/atomic instead of sync/atomic
- pkg: "github.com/pkg/errors"
desc: Use errors instead of github.com/pkg/errors
- pkg: "github.com/go-kit/kit/log"
desc: Use github.com/go-kit/log instead of github.com/go-kit/kit/log
- pkg: "golang.org/x/sync/errgroup"
desc: Use github.com/oklog/run instead of golang.org/x/sync/errgroup
whitespace:
# While there normally shouldn't be extra redundant leading/trailing
# whitespace, if statement conditions and function headers that cross
# multiple lines are an exception.
#
# if true ||
# false {
#
# // ... ^ must have empty line above
# }
#
# func foo(
# a int,
# ) {
#
# // ... ^ must have empty line above
# }
#
# This helps readers easily separate where the multi-line if/function ends
# at a glance.
multi-if: true
multi-func: true
revive:
rules:
- name: package-comments
disabled: true