Repository navigation
Expand file tree
/
Copy path.golangci.yml
More file actions
94 lines (89 loc) · 2.94 KB
/
Copy path.golangci.yml
File metadata and controls
94 lines (89 loc) · 2.94 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
version: "2"
# The package parses bytes which come from the network, so the set below
# leans towards correctness and security checks and away from style opinions.
linters:
default: none
enable:
- bidichk # bidirectional unicode in source, a supply-chain trick
- copyloopvar
- errcheck
- errorlint # error comparison and wrapping done correctly
- gocritic
- gosec # the security checks; see the nolint notes in the source
- govet
- ineffassign
- makezero
- misspell
- nilerr
- predeclared # shadowing new, len, cap and friends
- revive
- staticcheck
- unconvert
- unused
- usestdlibvars
- wastedassign
settings:
govet:
enable-all: true
disable:
- fieldalignment # generated structs are laid out by protoc
gocritic:
enabled-tags:
- diagnostic
- performance
- style
disabled-checks:
- unnamedResult
- hugeParam # gen.Config is a plain options struct passed by value
staticcheck:
checks:
- "all"
- "-ST1003" # Exported names like DefaultJsonPushEncoder are part of the public API.
- "-ST1000" # No need in package comment check.
- "-QF1008" # Generated code names embedded structs in full: a field may be hidden by another.
revive:
rules:
- name: exported
- name: var-naming
- name: indent-error-flow
- name: errorf
- name: range-val-in-closure
exclusions:
# Generated files are linted like code written by hand: the decoders in
# client.pb_cfjson.go and client.pb_cfprotobuf.go are what actually reads
# untrusted input.
generated: disable
# Except for what protoc-gen-go generates, which is not ours to change.
paths:
- client\.pb\.go$
# Snapshots of the JSON and Protobuf code this package had before
# cfjson and cfprotobuf, kept for comparison. They are modules of their
# own, this only matters when the linter is run from inside of one.
- internal/cfjsoncmp/
- internal/cfprotobufcmp/
rules:
# Test data has to be deterministic, so it is generated with math/rand
# (G404) and narrowed to small integers (G115). Neither is a security
# boundary. Every other gosec check still applies to the tests.
- path: _test\.go
text: "G404|G115"
linters:
- gosec
# Renaming these would break the public API.
- path: type\.go
text: "var-naming: var DefaultJson"
linters:
- revive
# b.Fatal/t.Fatal end the test, but SA5011 does not model that and reports
# a possible nil dereference after a nil check followed by Fatal.
- path: _test\.go
text: "SA5011"
linters:
- staticcheck
issues:
# Report everything: a finding hidden behind a limit is still a finding.
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt