-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.golangci.yml
More file actions
110 lines (106 loc) · 2.57 KB
/
Copy path.golangci.yml
File metadata and controls
110 lines (106 loc) · 2.57 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# golangci-lint configuration.
#
# This is the v2 schema. golangci-lint v1 reached end of life and refuses to
# run nothing but v1 configs, while v2 refuses to run a v1 config at all, so the
# `version` key below is load-bearing: without it `golangci-lint run` fails with
# "unsupported version of the configuration" before a single file is inspected.
# The Makefile pins the matching v2 module path.
version: "2"
linters:
# errcheck, govet, ineffassign, staticcheck and unused are enabled by
# default in v2; gosimple was folded into staticcheck. Only the extras are
# listed here.
enable:
- dupl
- goconst
- gocyclo
- misspell
settings:
dupl:
threshold: 100
errcheck:
check-type-assertions: false
check-blank: false
exclude-functions:
- fmt.Fprintf
- fmt.Fprintln
- fmt.Fprint
- fmt.Printf
- fmt.Println
- fmt.Print
- fmt.Sprint
- (*net/http.ResponseWriter).Write
- (*encoding/json.Encoder).Encode
- (*encoding/gob.Encoder).Encode
goconst:
min-len: 4
min-occurrences: 6
gocyclo:
min-complexity: 20
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Tests trade duplication and error handling for readability.
- path: _test\.go
linters:
- dupl
- errcheck
- goconst
- gocyclo
- staticcheck
- unused
# Docker API constants
- source: '"container"'
linters:
- goconst
# Allow unchecked writes in HTTP handlers
- source: w\.Write\(
linters:
- errcheck
- source: \.Encode\(
linters:
- errcheck
- source: Shutdown\(
linters:
- errcheck
- source: SetDeadline\(
linters:
- errcheck
- source: rand\.Read\(
linters:
- errcheck
- source: SaveMeta\(
linters:
- errcheck
- source: MkdirAll\(
linters:
- errcheck
- source: Execute\(
linters:
- errcheck
- source: AddWhitelist\(|AddBlacklist\(
linters:
- errcheck
# Config validation is complex by nature
- path: internal/config/
linters:
- gocyclo
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$