@@ -10,7 +10,7 @@ import (
1010 "strings"
1111 "sync"
1212
13- "github.com/go-lintpack/lintpack "
13+ gocriticlinter "github.com/go-critic/go-critic/framework/linter "
1414 "golang.org/x/tools/go/analysis"
1515
1616 "github.com/golangci/golangci-lint/pkg/config"
@@ -38,15 +38,15 @@ func NewGocritic() *goanalysis.Linter {
3838 nil ,
3939 ).WithContextSetter (func (lintCtx * linter.Context ) {
4040 analyzer .Run = func (pass * analysis.Pass ) (interface {}, error ) {
41- lintpackCtx := lintpack .NewContext (pass .Fset , sizes )
42- enabledCheckers , err := buildEnabledCheckers (lintCtx , lintpackCtx )
41+ linterCtx := gocriticlinter .NewContext (pass .Fset , sizes )
42+ enabledCheckers , err := buildEnabledCheckers (lintCtx , linterCtx )
4343 if err != nil {
4444 return nil , err
4545 }
4646
47- lintpackCtx .SetPackageInfo (pass .TypesInfo , pass .Pkg )
47+ linterCtx .SetPackageInfo (pass .TypesInfo , pass .Pkg )
4848 var res []goanalysis.Issue
49- pkgIssues := runGocriticOnPackage (lintpackCtx , enabledCheckers , pass .Files )
49+ pkgIssues := runGocriticOnPackage (linterCtx , enabledCheckers , pass .Files )
5050 for i := range pkgIssues {
5151 res = append (res , goanalysis .NewIssue (& pkgIssues [i ], pass ))
5252 }
@@ -65,17 +65,17 @@ func NewGocritic() *goanalysis.Linter {
6565 }).WithLoadMode (goanalysis .LoadModeTypesInfo )
6666}
6767
68- func normalizeCheckerInfoParams (info * lintpack .CheckerInfo ) lintpack .CheckerParams {
68+ func normalizeCheckerInfoParams (info * gocriticlinter .CheckerInfo ) gocriticlinter .CheckerParams {
6969 // lowercase info param keys here because golangci-lint's config parser lowercases all strings
70- ret := lintpack .CheckerParams {}
70+ ret := gocriticlinter .CheckerParams {}
7171 for k , v := range info .Params {
7272 ret [strings .ToLower (k )] = v
7373 }
7474
7575 return ret
7676}
7777
78- func configureCheckerInfo (info * lintpack .CheckerInfo , allParams map [string ]config.GocriticCheckSettings ) error {
78+ func configureCheckerInfo (info * gocriticlinter .CheckerInfo , allParams map [string ]config.GocriticCheckSettings ) error {
7979 params := allParams [strings .ToLower (info .Name )]
8080 if params == nil { // no config for this checker
8181 return nil
@@ -108,12 +108,12 @@ func configureCheckerInfo(info *lintpack.CheckerInfo, allParams map[string]confi
108108 return nil
109109}
110110
111- func buildEnabledCheckers (lintCtx * linter.Context , lintpackCtx * lintpack .Context ) ([]* lintpack .Checker , error ) {
111+ func buildEnabledCheckers (lintCtx * linter.Context , linterCtx * gocriticlinter .Context ) ([]* gocriticlinter .Checker , error ) {
112112 s := lintCtx .Settings ().Gocritic
113113 allParams := s .GetLowercasedParams ()
114114
115- var enabledCheckers []* lintpack .Checker
116- for _ , info := range lintpack .GetCheckersInfo () {
115+ var enabledCheckers []* gocriticlinter .Checker
116+ for _ , info := range gocriticlinter .GetCheckersInfo () {
117117 if ! s .IsCheckEnabled (info .Name ) {
118118 continue
119119 }
@@ -122,27 +122,27 @@ func buildEnabledCheckers(lintCtx *linter.Context, lintpackCtx *lintpack.Context
122122 return nil , err
123123 }
124124
125- c := lintpack .NewChecker (lintpackCtx , info )
125+ c := gocriticlinter .NewChecker (linterCtx , info )
126126 enabledCheckers = append (enabledCheckers , c )
127127 }
128128
129129 return enabledCheckers , nil
130130}
131131
132- func runGocriticOnPackage (lintpackCtx * lintpack .Context , checkers []* lintpack .Checker ,
132+ func runGocriticOnPackage (linterCtx * gocriticlinter .Context , checkers []* gocriticlinter .Checker ,
133133 files []* ast.File ) []result.Issue {
134134 var res []result.Issue
135135 for _ , f := range files {
136- filename := filepath .Base (lintpackCtx .FileSet .Position (f .Pos ()).Filename )
137- lintpackCtx .SetFileInfo (filename , f )
136+ filename := filepath .Base (linterCtx .FileSet .Position (f .Pos ()).Filename )
137+ linterCtx .SetFileInfo (filename , f )
138138
139- issues := runGocriticOnFile (lintpackCtx , f , checkers )
139+ issues := runGocriticOnFile (linterCtx , f , checkers )
140140 res = append (res , issues ... )
141141 }
142142 return res
143143}
144144
145- func runGocriticOnFile (ctx * lintpack .Context , f * ast.File , checkers []* lintpack .Checker ) []result.Issue {
145+ func runGocriticOnFile (ctx * gocriticlinter .Context , f * ast.File , checkers []* gocriticlinter .Checker ) []result.Issue {
146146 var res []result.Issue
147147
148148 for _ , c := range checkers {
0 commit comments