parent
25fcad6e08
commit
247b6c2796
1
go.mod
1
go.mod
@ -54,6 +54,7 @@ require (
|
||||
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2
|
||||
github.com/tetafro/godot v0.4.9
|
||||
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e
|
||||
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d
|
||||
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa
|
||||
github.com/ultraware/funlen v0.0.3
|
||||
github.com/ultraware/whitespace v0.0.4
|
||||
|
2
go.sum
generated
2
go.sum
generated
@ -376,6 +376,8 @@ github.com/tetafro/godot v0.4.9/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQx
|
||||
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q=
|
||||
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d h1:3EZyvNUMsGD1QA8cu0STNn1L7I77rvhf2IhOcHYQhSw=
|
||||
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d/go.mod h1:yiFB6fFoV7saXirUGfuK+cPtUh4NX/Hf5y2WC2lehu0=
|
||||
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As=
|
||||
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig=
|
||||
github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA=
|
||||
|
19
pkg/golinters/wrapcheck.go
Normal file
19
pkg/golinters/wrapcheck.go
Normal file
@ -0,0 +1,19 @@
|
||||
package golinters
|
||||
|
||||
import (
|
||||
"github.com/tomarrell/wrapcheck/wrapcheck"
|
||||
"golang.org/x/tools/go/analysis"
|
||||
|
||||
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
|
||||
)
|
||||
|
||||
const wrapcheckName = "wrapcheck"
|
||||
|
||||
func NewWrapcheck() *goanalysis.Linter {
|
||||
return goanalysis.NewLinter(
|
||||
wrapcheckName,
|
||||
wrapcheck.Analyzer.Doc,
|
||||
[]*analysis.Analyzer{wrapcheck.Analyzer},
|
||||
nil,
|
||||
).WithLoadMode(goanalysis.LoadModeTypesInfo)
|
||||
}
|
@ -307,10 +307,15 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
||||
WithPresets(linter.PresetStyle).
|
||||
WithLoadForGoAnalysis().
|
||||
WithURL("https://github.com/ssgreg/nlreturn"),
|
||||
linter.NewConfig(golinters.NewWrapcheck()).
|
||||
WithPresets(linter.PresetStyle).
|
||||
WithLoadForGoAnalysis().
|
||||
WithURL("https://github.com/tomarrell/wrapcheck"),
|
||||
linter.NewConfig(golinters.NewTparallel()).
|
||||
WithPresets(linter.PresetStyle).
|
||||
WithLoadForGoAnalysis().
|
||||
WithURL("https://github.com/moricho/tparallel"),
|
||||
|
||||
// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
|
||||
linter.NewConfig(golinters.NewNoLintLint()).
|
||||
WithPresets(linter.PresetStyle).
|
||||
|
19
test/testdata/wrapcheck.go
vendored
Normal file
19
test/testdata/wrapcheck.go
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
//args: -Ewrapcheck
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func main() {
|
||||
do()
|
||||
}
|
||||
|
||||
func do() error {
|
||||
_, err := json.Marshal(struct{}{})
|
||||
if err != nil {
|
||||
return err // ERROR "error returned from external package is unwrapped"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user