This repository has been archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.golangci.yml
106 lines (91 loc) · 4.39 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# options for analysis running
run:
timeout: 10m
tests: true
silent: true
# output configuration options
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
# all available settings of specific linters
linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
govet:
check-shadowing: false
disable:
- shadow
gofmt:
simplify: true
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: UK
unused:
check-exported: false
unparam:
algo: cha
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true
for-loops: true
linters:
enable:
- golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
- misspell # Finds commonly misspelled English words in comments [fast: true]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true]
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false]
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
- unused # Checks Go code for unused constants, variables, functions and types [fast: false]
- gas # Inspects source code for security problems [fast: false]
- structcheck # Finds an unused struct fields [fast: false]
- interfacer # Linter that suggests narrower interface types [fast: false]
- unconvert # Remove unnecessary type conversions [fast: false]
- unparam # Reports unused function parameters [fast: false]
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true]
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
disable:
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]
- lll # Reports long lines [fast: true]
- dupl # Tool for code clone detection [fast: true]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false]
- varcheck # Finds unused global variables and constants [fast: false]
- deadcode # Finds unused code [fast: false]
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: false]
- goconst # Finds repeated strings that could be replaced by a constant [fast: true]
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true]
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted [fast: false]
- megacheck # 3 sub-linters in one: unused, gosimple and staticcheck [fast: false]
issues:
exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of
.((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv|.*Disconnect).
is not checked
# golint: Exported variables are rarely used and generally reserved for errors which should be self explanitory
- exported var \w+ should have comment or be unexported
# golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that
stutters; consider calling this
# gas: Too many false-positives on 'unsafe' usage
- Use of unsafe calls should be audited
# gas: Too many false-positives for parametrized shell calls
- Subprocess launch(ed with variable|ing should be audited)
# gas: Duplicated errcheck checks
- G104
# gas: Too many issues in popular repos
- (Expect directory permissions to be 0750 or less|Expect file permissions
to be 0600 or less)
# gas: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
- Potential file inclusion via variable
# govet: Common false positives
- (possible misuse of unsafe.Pointer|should have signature)
# megacheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
- ineffective break statement. Did you mean to break out of the outer loop