Skip to content

Commit b89e1bd

Browse files
committed
newlinter: Adding gofuncor linter
1 parent d01e5ac commit b89e1bd

File tree

6 files changed

+21
-58
lines changed

6 files changed

+21
-58
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ require (
7373
github.com/ldez/usetesting v0.4.2
7474
github.com/leonklingele/grouper v1.1.2
7575
github.com/macabu/inamedparam v0.2.0
76-
github.com/manuelarte/gofuncor v0.0.3
76+
github.com/manuelarte/gofuncor v0.0.4
7777
github.com/maratori/testableexamples v1.0.0
7878
github.com/maratori/testpackage v1.1.1
7979
github.com/matoous/godox v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/gofuncor/testdata/constructors_before_struct.go

Lines changed: 0 additions & 33 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
package simple
1+
package testdata
2+
3+
type MyStruct struct {
4+
Name string
5+
}
6+
7+
func (m MyStruct) lenName() int { // want `unexported method "lenName" for struct "MyStruct" should be placed after the exported method "GetName"`
8+
return len(m.Name)
9+
}
10+
11+
func (m MyStruct) GetName() string {
12+
return m.Name
13+
}
14+
15+
func (m *MyStruct) SetName(name string) {
16+
m.Name = name
17+
}
218

3-
//nolint:recvcheck // testing linter
419
type MyStruct2 struct {
520
Name string
621
}
@@ -13,12 +28,6 @@ func (m *MyStruct2) SetName(name string) {
1328
m.Name = name
1429
}
1530

16-
//nolint:nonamedreturns // testing linter
17-
func NewOtherMyStruct2() (m *MyStruct2) { // want `constructor 'NewOtherMyStruct2' for struct 'MyStruct2' should be placed before struct method 'GetName'`
18-
m = &MyStruct2{Name: "John"}
19-
return
20-
}
21-
2231
func NewMyStruct2() *MyStruct2 { // want `constructor \"NewMyStruct2\" for struct \"MyStruct2\" should be placed before struct method \"GetName\"`
2332
return &MyStruct2{Name: "John"}
2433
}

pkg/golinters/gofuncor/testdata/struct_not_declared_in_file.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

pkg/lint/lintersdb/builder_linter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
337337
WithURL("https://github.com/mvdan/gofumpt"),
338338

339339
linter.NewConfig(gofuncor.New(&cfg.Linters.Settings.GoFuncOr)).
340-
WithSince("v1.65.0").
340+
WithSince("v2.0.2").
341341
WithAutoFix().
342342
WithURL("https://github.com/manuelarte/gofuncor"),
343343

0 commit comments

Comments
 (0)