Skip to content

Commit ba435ae

Browse files
committed
fix: minor optimization
1 parent 3e2231e commit ba435ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tagliatelle.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func New(config Config) *analysis.Analyzer {
4545
return &analysis.Analyzer{
4646
Name: "tagliatelle",
4747
Doc: "Checks the struct tags.",
48-
Run: func(pass *analysis.Pass) (interface{}, error) {
48+
Run: func(pass *analysis.Pass) (any, error) {
4949
if len(config.Rules) == 0 && len(config.Overrides) == 0 {
5050
return nil, nil
5151
}
@@ -58,7 +58,7 @@ func New(config Config) *analysis.Analyzer {
5858
}
5959
}
6060

61-
func run(pass *analysis.Pass, config Config) (interface{}, error) {
61+
func run(pass *analysis.Pass, config Config) (any, error) {
6262
isp, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
6363
if !ok {
6464
return nil, errors.New("missing inspect analyser")
@@ -74,11 +74,11 @@ func run(pass *analysis.Pass, config Config) (interface{}, error) {
7474
_, cfg, _ = radixTree.Root().LongestPrefix([]byte(pass.Pkg.Path()))
7575
}
7676

77-
isp.Preorder(nodeFilter, func(n ast.Node) {
78-
if cfg.Ignore {
79-
return
80-
}
77+
if cfg.Ignore {
78+
return nil, nil
79+
}
8180

81+
isp.Preorder(nodeFilter, func(n ast.Node) {
8282
node, ok := n.(*ast.StructType)
8383
if !ok {
8484
return

0 commit comments

Comments
 (0)