Skip to content

Commit 21eae66

Browse files
committed
chore: groups gochecksumtype files to a package
1 parent 56dde9a commit 21eae66

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

pkg/golinters/gochecksumtype.go renamed to pkg/golinters/gochecksumtype/gochecksumtype.go

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

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

16-
const goCheckSumTypeName = "gochecksumtype"
16+
const name = "gochecksumtype"
1717

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

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

4343
return goanalysis.NewLinter(
44-
goCheckSumTypeName,
44+
name,
4545
`Run exhaustiveness checks on Go "sum types"`,
4646
[]*analysis.Analyzer{analyzer},
4747
nil,
@@ -70,7 +70,7 @@ func runGoCheckSumType(pass *analysis.Pass) ([]goanalysis.Issue, error) {
7070
}
7171

7272
resIssues = append(resIssues, goanalysis.NewIssue(&result.Issue{
73-
FromLinter: goCheckSumTypeName,
73+
FromLinter: name,
7474
Text: strings.TrimPrefix(err.Error(), err.Pos().String()+": "),
7575
Pos: err.Pos(),
7676
}, pass))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package gochecksumtype
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+
}

pkg/lint/lintersdb/builder_linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/golangci/golangci-lint/pkg/golinters/gocheckcompilerdirectives"
3636
"github.com/golangci/golangci-lint/pkg/golinters/gochecknoglobals"
3737
"github.com/golangci/golangci-lint/pkg/golinters/gochecknoinits"
38+
"github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype"
3839
"github.com/golangci/golangci-lint/pkg/golinters/gocritic"
3940
"github.com/golangci/golangci-lint/pkg/golinters/godot"
4041
"github.com/golangci/golangci-lint/pkg/golinters/gofmt"
@@ -268,7 +269,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
268269
WithSince("v1.12.0").
269270
WithPresets(linter.PresetStyle),
270271

271-
linter.NewConfig(golinters.NewGoCheckSumType()).
272+
linter.NewConfig(gochecksumtype.New()).
272273
WithSince("v1.55.0").
273274
WithPresets(linter.PresetBugs).
274275
WithLoadForGoAnalysis().

0 commit comments

Comments
 (0)