...
1# Start with a very conservative configuration, and slowly turn things
2# back on.
3linters:
4 disable-all: true
5 enable:
6 - gofmt
7 - govet
8 - depguard
9 - unused
10 - errcheck
11linters-settings:
12 gofmt:
13 simplify: true
14 depguard:
15 list-type: blacklist
16 include-go-root: true
17 packages-with-error-message:
18 - log: "Use `github.com/datawire/dlib/dlog` instead of `log`"
19 - github.com/sirupsen/logrus: "Use `github.com/datawire/dlib/dlog` instead of `github.com/sirupsen/logrus`"
20 - github.com/datawire/dlib/dutil: "Use either `github.com/datawire/dlib/derror` or `github.com/datawire/dlib/dhttp` instead of `github.com/datawire/dlib/dutil`"
21 - github.com/gogo/protobuf: "Use `google.golang.org/protobuf` instead of `github.com/gogo/protobuf`"
22 - github.com/golang/protobuf: "Use `google.golang.org/protobuf` instead of `github.com/golang/protobuf`"
23 - github.com/google/shlex: "Use `github.com/kballard/go-shellquote` instead of `github.com/google/shlex`"
24 - golang.org/x/net/http2/h2c: "Use `github.com/datawire/dlib/dhttp` instead of `golang.org/x/net/http2/h2c`"
25 unused:
26 # treat code as a program (not a library) and report unused
27 # exported identifiers
28 check-exported: true
29 errcheck:
30 exclude-functions:
31 - "(net/http.ResponseWriter).Write"
32issues:
33 exclude-rules:
34 - linters: [govet, errcheck, unused]
35 path: pkg/envoy-control-plane/
36 - linters: [depguard]
37 path: "pkg/envoy-control-plane/(test/|.*_test\\.go)"
38 - linters: [depguard]
39 path: "pkg/envoy-control-plane/"
40 source: '"github\.com/golang/protobuf'
41 - linters: [govet]
42 text: "^tests: .* should return nothing$"
43run:
44 timeout: 9m # CircleCI is slow?
45
46# I don't know of a linter that lets you blacklist specific functions
47# and variables within a package, but if one exists, I would like to
48# blacklist all of the following for the reason "Don't use globals!":
49#
50# - net/http.DefaultServeMux
51# * net/http.Handle()
52# * net/http.HandleFunc()
53# - flag.CommandLine
54# * flag.VisitAll()
55# * flag.Visit()
56# * flag.Lookup()
57# * flag.Set()
58# * flag.PrintDefaults()
59# * flag.Usage()
60# * flag.NFlag()
61# * flag.Arg()
62# * flag.NArg()
63# * flag.Args()
64# * flag.BoolVar()
65# * flag.Bool()
66# * flag.IntVar()
67# * flag.Int()
68# * flag.Int64Var()
69# * flag.Int64()
70# * flag.UintVar()
71# * flag.Uint()
72# * flag.Uint64Var()
73# * flag.Uint64()
74# * flag.StringVar()
75# * flag.String()
76# * flag.Float64Var()
77# * flag.Float64()
78# * flag.DurationVar()
79# * flag.Duration()
80# * flag.Var()
81# * flag.Parse()
82# * flag.Parsed()
83#
84# I'd also like to blacklist parts of net/http to enforce using dhttp:
85#
86# - net/http.Server // use dhttp.ServerConfig instead!
87# * net/http.Serve()
88# * net/http.ServeTLS()
89# * net/http.ListenAndServe()
90# * net/http.ListenAndServeTLS()
91# - google.golang.org/grpc.Server.Serve // use dhttp.ServerConfig{Handler: grpcServer}.Serve instead!
92
93# The old configuration, that hasn't been used for many months:
94
95#linters:
96# enable-all: true
97# disable:
98# - errcheck
99# - gochecknoglobals
100# - gochecknoinits
101# - golint
102# - interfacer # author says it's deprecated, gives very subjective advice
103# - lll
104# - maligned
105# - prealloc
106# - scopelint
107# - stylecheck
108# - unparam
109#linters-settings:
110# goimports:
111# # put imports beginning with prefix after 3rd-party packages;
112# # it's a comma-separated list of prefixes
113# local-prefixes: github.com/datawire/apro,github.com/lyft/ratelimit
114# depguard:
115# list-type: blacklist
116# include-go-root: true
117# packages:
118# - errors # use "github.com/pkg/errors"
119# - golang.org/x/net/context # use "context"
120# - github.com/datawire/teleproxy # use "github.com/datawire/ambassador/pkg"
121# - github.com/datawire/ambassador/go # use "github.com/datawire/ambassador/pkg"
122# - github.com/datawire/kat-backend/xds # use "github.com/datawire/ambassador/pkg/api/envoy"
123# - github.com/lyft/ratelimit/proto # use "github.com/datawire/ambassador/pkg/api/envoy"
124# #- github.com/russross/blackfriday # use "github.com/russross/blackfriday/v2" # can't turn off prefix-matching
125# - gopkg.in/russross/blackfriday.v2 # use "github.com/russross/blackfriday/v2"
126# goconst:
127# min-len: 12
128#issues:
129# new-from-rev: a72c53cbcd05c806b1838d95146d049b09a51ffb
130#run:
131# build-tags:
132# - test
133# - integration
134# - lint
View as plain text