forked from emissary-ingress/emissary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
141 lines (138 loc) · 4.56 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Start with a very conservative configuration, and slowly turn things
# back on.
linters:
disable-all: true
enable:
- gofmt
- govet
- depguard
- unused
- errcheck
linters-settings:
gofmt:
simplify: true
depguard:
rules:
main:
deny:
- pkg: "log"
desc: "Use `github.com/datawire/dlib/dlog` instead of `log`"
- pkg: "github.com/sirupsen/logrus"
desc: "Use `github.com/datawire/dlib/dlog` instead of `github.com/sirupsen/logrus`"
- pkg: "github.com/datawire/dlib/dutil"
desc: "Use either `github.com/datawire/dlib/derror` or `github.com/datawire/dlib/dhttp` instead of `github.com/datawire/dlib/dutil`"
- pkg: "github.com/gogo/protobuf"
desc: "Use `google.golang.org/protobuf` instead of `github.com/gogo/protobuf`"
- pkg: "github.com/golang/protobuf"
desc: "Use `google.golang.org/protobuf` instead of `github.com/golang/protobuf`"
- pkg: "github.com/google/shlex"
desc: "Use `github.com/kballard/go-shellquote` instead of `github.com/google/shlex`"
- pkg: "golang.org/x/net/http2/h2c"
desc: "Use `github.com/datawire/dlib/dhttp` instead of `golang.org/x/net/http2/h2c`"
unused:
# treat code as a program (not a library) and report unused
# exported identifiers
check-exported: true
errcheck:
exclude-functions:
- "(net/http.ResponseWriter).Write"
issues:
exclude-rules:
- linters: [govet, errcheck, unused]
path: pkg/envoy-control-plane/
- linters: [depguard]
path: "pkg/envoy-control-plane/(test/|.*_test\\.go)"
- linters: [depguard]
path: "pkg/envoy-control-plane/"
source: '"github\.com/golang/protobuf'
- linters: [govet]
text: "^tests: .* should return nothing$"
run:
timeout: 9m # CircleCI is slow?
# I don't know of a linter that lets you blacklist specific functions
# and variables within a package, but if one exists, I would like to
# blacklist all of the following for the reason "Don't use globals!":
#
# - net/http.DefaultServeMux
# * net/http.Handle()
# * net/http.HandleFunc()
# - flag.CommandLine
# * flag.VisitAll()
# * flag.Visit()
# * flag.Lookup()
# * flag.Set()
# * flag.PrintDefaults()
# * flag.Usage()
# * flag.NFlag()
# * flag.Arg()
# * flag.NArg()
# * flag.Args()
# * flag.BoolVar()
# * flag.Bool()
# * flag.IntVar()
# * flag.Int()
# * flag.Int64Var()
# * flag.Int64()
# * flag.UintVar()
# * flag.Uint()
# * flag.Uint64Var()
# * flag.Uint64()
# * flag.StringVar()
# * flag.String()
# * flag.Float64Var()
# * flag.Float64()
# * flag.DurationVar()
# * flag.Duration()
# * flag.Var()
# * flag.Parse()
# * flag.Parsed()
#
# I'd also like to blacklist parts of net/http to enforce using dhttp:
#
# - net/http.Server // use dhttp.ServerConfig instead!
# * net/http.Serve()
# * net/http.ServeTLS()
# * net/http.ListenAndServe()
# * net/http.ListenAndServeTLS()
# - google.golang.org/grpc.Server.Serve // use dhttp.ServerConfig{Handler: grpcServer}.Serve instead!
# The old configuration, that hasn't been used for many months:
#linters:
# enable-all: true
# disable:
# - errcheck
# - gochecknoglobals
# - gochecknoinits
# - golint
# - interfacer # author says it's deprecated, gives very subjective advice
# - lll
# - maligned
# - prealloc
# - scopelint
# - stylecheck
# - unparam
#linters-settings:
# goimports:
# # put imports beginning with prefix after 3rd-party packages;
# # it's a comma-separated list of prefixes
# local-prefixes: github.com/datawire/apro,github.com/lyft/ratelimit
# depguard:
# list-type: blacklist
# include-go-root: true
# packages:
# - errors # use "github.com/pkg/errors"
# - golang.org/x/net/context # use "context"
# - github.com/datawire/teleproxy # use "github.com/datawire/ambassador/pkg"
# - github.com/datawire/ambassador/go # use "github.com/datawire/ambassador/pkg"
# - github.com/datawire/kat-backend/xds # use "github.com/datawire/ambassador/pkg/api/envoy"
# - github.com/lyft/ratelimit/proto # use "github.com/datawire/ambassador/pkg/api/envoy"
# #- github.com/russross/blackfriday # use "github.com/russross/blackfriday/v2" # can't turn off prefix-matching
# - gopkg.in/russross/blackfriday.v2 # use "github.com/russross/blackfriday/v2"
# goconst:
# min-len: 12
#issues:
# new-from-rev: a72c53cbcd05c806b1838d95146d049b09a51ffb
#run:
# build-tags:
# - test
# - integration
# - lint