Skip to content

Commit fa7126e

Browse files
committed
chore: groups makezero files to a package
1 parent 0669a54 commit fa7126e

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

pkg/golinters/makezero.go renamed to pkg/golinters/makezero/makezero.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package golinters
1+
package makezero
22

33
import (
44
"fmt"
@@ -13,14 +13,14 @@ import (
1313
"github.com/golangci/golangci-lint/pkg/result"
1414
)
1515

16-
const makezeroName = "makezero"
16+
const name = "makezero"
1717

18-
func NewMakezero(settings *config.MakezeroSettings) *goanalysis.Linter {
18+
func New(settings *config.MakezeroSettings) *goanalysis.Linter {
1919
var mu sync.Mutex
2020
var resIssues []goanalysis.Issue
2121

2222
analyzer := &analysis.Analyzer{
23-
Name: makezeroName,
23+
Name: name,
2424
Doc: goanalysis.TheOnlyanalyzerDoc,
2525
Run: func(pass *analysis.Pass) (any, error) {
2626
issues, err := runMakeZero(pass, settings)
@@ -41,7 +41,7 @@ func NewMakezero(settings *config.MakezeroSettings) *goanalysis.Linter {
4141
}
4242

4343
return goanalysis.NewLinter(
44-
makezeroName,
44+
name,
4545
"Finds slice declarations with non-zero initial length",
4646
[]*analysis.Analyzer{analyzer},
4747
nil,
@@ -65,7 +65,7 @@ func runMakeZero(pass *analysis.Pass, settings *config.MakezeroSettings) ([]goan
6565
issues = append(issues, goanalysis.NewIssue(&result.Issue{
6666
Pos: hint.Position(),
6767
Text: hint.Details(),
68-
FromLinter: makezeroName,
68+
FromLinter: name,
6969
}, pass))
7070
}
7171
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package makezero
2+
3+
import (
4+
"testing"
5+
6+
"github.com/golangci/golangci-lint/test/testshared/integration"
7+
)
8+
9+
func TestFromTestdata(t *testing.T) {
10+
integration.RunTestdata(t)
11+
}

test/testdata/makezero_always.go renamed to pkg/golinters/makezero/testdata/makezero_always.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//golangcitest:args -Emakezero
2-
//golangcitest:config_path testdata/configs/makezero_always.yml
2+
//golangcitest:config_path testdata/makezero_always.yml
33
package testdata
44

55
import "math"

pkg/lint/lintersdb/builder_linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import (
6363
"github.com/golangci/golangci-lint/pkg/golinters/lll"
6464
"github.com/golangci/golangci-lint/pkg/golinters/loggercheck"
6565
"github.com/golangci/golangci-lint/pkg/golinters/maintidx"
66+
"github.com/golangci/golangci-lint/pkg/golinters/makezero"
6667
"github.com/golangci/golangci-lint/pkg/golinters/mirror"
6768
"github.com/golangci/golangci-lint/pkg/golinters/misspell"
6869
"github.com/golangci/golangci-lint/pkg/golinters/mnd"
@@ -487,7 +488,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
487488
WithPresets(linter.PresetComplexity).
488489
WithURL("https://github.com/yagipy/maintidx"),
489490

490-
linter.NewConfig(golinters.NewMakezero(&cfg.LintersSettings.Makezero)).
491+
linter.NewConfig(makezero.New(&cfg.LintersSettings.Makezero)).
491492
WithSince("v1.34.0").
492493
WithPresets(linter.PresetStyle, linter.PresetBugs).
493494
WithLoadForGoAnalysis().

0 commit comments

Comments
 (0)