File tree 5 files changed +46
-0
lines changed
5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ require (
54
54
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2
55
55
github.com/tetafro/godot v0.4.9
56
56
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e
57
+ github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d
57
58
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa
58
59
github.com/ultraware/funlen v0.0.3
59
60
github.com/ultraware/whitespace v0.0.4
Original file line number Diff line number Diff line change
1
+ package golinters
2
+
3
+ import (
4
+ "github.com/tomarrell/wrapcheck/wrapcheck"
5
+ "golang.org/x/tools/go/analysis"
6
+
7
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8
+ )
9
+
10
+ const wrapcheckName = "wrapcheck"
11
+
12
+ func NewWrapcheck () * goanalysis.Linter {
13
+ return goanalysis .NewLinter (
14
+ wrapcheckName ,
15
+ wrapcheck .Analyzer .Doc ,
16
+ []* analysis.Analyzer {wrapcheck .Analyzer },
17
+ nil ,
18
+ ).WithLoadMode (goanalysis .LoadModeTypesInfo )
19
+ }
Original file line number Diff line number Diff line change @@ -307,10 +307,15 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
307
307
WithPresets (linter .PresetStyle ).
308
308
WithLoadForGoAnalysis ().
309
309
WithURL ("https://github.com/ssgreg/nlreturn" ),
310
+ linter .NewConfig (golinters .NewWrapcheck ()).
311
+ WithPresets (linter .PresetStyle ).
312
+ WithLoadForGoAnalysis ().
313
+ WithURL ("https://github.com/tomarrell/wrapcheck" ),
310
314
linter .NewConfig (golinters .NewTparallel ()).
311
315
WithPresets (linter .PresetStyle ).
312
316
WithLoadForGoAnalysis ().
313
317
WithURL ("https://github.com/moricho/tparallel" ),
318
+
314
319
// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
315
320
linter .NewConfig (golinters .NewNoLintLint ()).
316
321
WithPresets (linter .PresetStyle ).
Original file line number Diff line number Diff line change
1
+ //args: -Ewrapcheck
2
+ package main
3
+
4
+ import (
5
+ "encoding/json"
6
+ )
7
+
8
+ func main () {
9
+ do ()
10
+ }
11
+
12
+ func do () error {
13
+ _ , err := json .Marshal (struct {}{})
14
+ if err != nil {
15
+ return err // ERROR "error returned from external package is unwrapped"
16
+ }
17
+
18
+ return nil
19
+ }
You can’t perform that action at this time.
0 commit comments