@@ -10,12 +10,13 @@ import (
10
10
"strings"
11
11
"sync"
12
12
13
- "github.com/quasilyte/go-ruleguard/ruleguard"
14
13
"golang.org/x/tools/go/analysis"
14
+
15
+ "github.com/quasilyte/go-ruleguard/ruleguard"
15
16
)
16
17
17
18
// Version contains extra version info.
18
- // It's is initialized via ldflags -X when ruleguard is built with Make.
19
+ // It's initialized via ldflags -X when ruleguard is built with Make.
19
20
// Can contain a git hash (dev builds) or a version tag (release builds).
20
21
var Version string
21
22
@@ -27,7 +28,7 @@ func docString() string {
27
28
return doc + " (" + Version + ")"
28
29
}
29
30
30
- // Analyzer exports ruleguard as a analysis-compatible object.
31
+ // Analyzer exports ruleguard as an analysis-compatible object.
31
32
var Analyzer = & analysis.Analyzer {
32
33
Name : "ruleguard" ,
33
34
Doc : docString (),
@@ -191,20 +192,20 @@ func newEngine() (*ruleguard.Engine, error) {
191
192
DebugFilter : flagDebugFilter ,
192
193
DebugImports : flagDebugImports ,
193
194
DebugPrint : debugPrint ,
194
- GroupFilter : func (g string ) bool {
195
+ GroupFilter : func (g * ruleguard. GoRuleGroup ) bool {
195
196
whyDisabled := ""
196
- enabled := flagEnable == "<all>" || enabledGroups [g ]
197
+ enabled := flagEnable == "<all>" || enabledGroups [g . Name ]
197
198
switch {
198
199
case ! enabled :
199
200
whyDisabled = "not enabled by -enabled flag"
200
- case disabledGroups [g ]:
201
+ case disabledGroups [g . Name ]:
201
202
whyDisabled = "disabled by -disable flag"
202
203
}
203
204
if flagDebugEnableDisable {
204
205
if whyDisabled != "" {
205
- debugPrint (fmt .Sprintf ("(-) %s is %s" , g , whyDisabled ))
206
+ debugPrint (fmt .Sprintf ("(-) %s is %s" , g . Name , whyDisabled ))
206
207
} else {
207
- debugPrint (fmt .Sprintf ("(+) %s is enabled" , g ))
208
+ debugPrint (fmt .Sprintf ("(+) %s is enabled" , g . Name ))
208
209
}
209
210
}
210
211
return whyDisabled == ""
0 commit comments