File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ func (w *goCriticWrapper) init(logger logutils.Log, settings *config.GoCriticSet
88
88
89
89
settingsWrapper := newSettingsWrapper (settings , logger )
90
90
settingsWrapper .InferEnabledChecks ()
91
+
91
92
// Validate must be after InferEnabledChecks, not before.
92
93
// Because it uses gathered information about tags set and finally enabled checks.
93
94
if err := settingsWrapper .Validate (); err != nil {
@@ -113,7 +114,17 @@ func (w *goCriticWrapper) run(pass *analysis.Pass) error {
113
114
114
115
linterCtx .SetPackageInfo (pass .TypesInfo , pass .Pkg )
115
116
117
+ needFileInfo := slices .ContainsFunc (enabledCheckers , func (c * gocriticlinter.Checker ) bool {
118
+ // Related to https://github.com/go-critic/go-critic/blob/440ff466685b41e67d231a1c4a8f5e093374ee93/checkers/importShadow_checker.go#L23
119
+ return strings .EqualFold (c .Info .Name , "importShadow" )
120
+ })
121
+
116
122
for _ , f := range pass .Files {
123
+ if needFileInfo {
124
+ // Related to https://github.com/go-critic/go-critic/blob/440ff466685b41e67d231a1c4a8f5e093374ee93/checkers/importShadow_checker.go#L23
125
+ linterCtx .SetFileInfo (f .Name .Name , f )
126
+ }
127
+
117
128
runOnFile (pass , f , enabledCheckers )
118
129
}
119
130
You can’t perform that action at this time.
0 commit comments