-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yml
109 lines (97 loc) · 4.12 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
106
107
108
109
run:
skip-dirs:
- "cmd/examples" # Commands are not part of the library, just examples at the moment
- "cmd/test"
tests: false
linters-settings:
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: true
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: true
# Enable all analyzers
enable-all: true
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# tab width in spaces. Default to 1.
tab-width: 4
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
ignore-words: []
# We want to keep the amount of dependencies to a minimum, so we use a whitelist here.
# This list is not automatically mutated by the go toolchain and thus provides a manual sanity check.
depguard:
list-type: whitelist
include-go-root: false
packages:
- github.com/vishvananda/netlink
- golang.org/x/sys
- github.com/dylandreimerink/gobpfld
- github.com/alecthomas/participle/v2
- github.com/spf13/cobra
- golang.org/x/tools/cover
- github.com/dylandreimerink/gocovmerge
- github.com/dylandreimerink/tarp
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- govet # Check for common errors
- errcheck # Check for missing error handling
- staticcheck # Adds extra checks on top of govet
- gosimple # Check for code which can be simpeler
- structcheck # Check for unused struct fields
- varcheck # Check for unused globals and consts
- ineffassign # Check for ineffectual assignments
- deadcode # Check for dead/unreachable code
- bodyclose # Check for unclosed HTTP bodies (causes resource leaking)
- gofmt # Check for code formatting
- gofumpt # Is stricter than gofmt
- gosec # Inspects source code for security problems
- unconvert # Remove unnecessary type conversions
- misspell # Finds commonly misspelled English words in comments
- lll # Reports long lines
- revive # A maintained replacement for golint
- depguard # Make sure we don't accidentally dependencies
# DO NOT ENABLE
# unused gives lots of false positives
# - unused # Check for unused consts, variables, functions and types
# golint is depricated
# - golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
issues:
exclude-rules:
# The library has a not of underscores due to copied C-style names, this will not change so code can be easily
# cross referenced with kernel sourcecode
- text: "don't use underscores in Go names"
linters:
- revive
# The library has a not of underscores due to copied C-style names, this will not change so code can be easily
# cross referenced with kernel sourcecode
- text: "don't use ALL_CAPS in Go names"
linters:
- revive
# staticcheck notes that using consts with value 0 has no effect. We know this, the code is there to convey intent
- path: ebpf/
text: "SA4016:"
linters:
- staticcheck
# variable shadowing is a bad thing, but shadowing err happens a lot due to the nature of err check in go
# so just of the err variable it can be ignored
- text: '"err" shadows declaration'
linters:
- govet
# fieldalignment is an optimization which often is traded of for readability of a struct
- text: "fieldalignment:"
linters:
- govet