Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,7 @@ linters:
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
Expand Down Expand Up @@ -2804,6 +2805,7 @@ linters:
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ require (
github.com/pelletier/go-toml/v2 v2.2.3
github.com/polyfloyd/go-errorlint v1.6.0
github.com/quasilyte/go-ruleguard/dsl v0.3.22
github.com/raeperd/recvcheck v0.1.2
github.com/ryancurrah/gomodguard v1.3.5
github.com/ryanrolds/sqlclosecheck v0.5.1
github.com/sanposhiho/wastedassign/v2 v2.0.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@
"promlinter",
"protogetter",
"reassign",
"recvcheck",
"revive",
"rowserrcheck",
"scopelint",
Expand Down
19 changes: 19 additions & 0 deletions pkg/golinters/recvcheck/recvcheck.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package recvcheck

import (
"github.com/raeperd/recvcheck"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/goanalysis"
)

func New() *goanalysis.Linter {
a := recvcheck.Analyzer

return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
11 changes: 11 additions & 0 deletions pkg/golinters/recvcheck/recvcheck_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package recvcheck_test

import (
"testing"

"github.com/golangci/golangci-lint/test/testshared/integration"
)

func TestFromTestdata(t *testing.T) {
integration.RunTestdata(t)
}
14 changes: 14 additions & 0 deletions pkg/golinters/recvcheck/testdata/recvcheck.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//golangcitest:args -Erecvcheck
package testdata

import "fmt"

type Bar struct{} // want `the methods of "Bar" use pointer receiver and non-pointer receiver.`

func (b Bar) A() {
fmt.Println("A")
}

func (b *Bar) B() {
fmt.Println("B")
}
7 changes: 7 additions & 0 deletions pkg/lint/lintersdb/builder_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/promlinter"
"github.com/golangci/golangci-lint/pkg/golinters/protogetter"
"github.com/golangci/golangci-lint/pkg/golinters/reassign"
"github.com/golangci/golangci-lint/pkg/golinters/recvcheck"
"github.com/golangci/golangci-lint/pkg/golinters/revive"
"github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck"
"github.com/golangci/golangci-lint/pkg/golinters/sloglint"
Expand Down Expand Up @@ -657,6 +658,12 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithLoadForGoAnalysis().
WithURL("https://github.com/curioswitch/go-reassign"),

linter.NewConfig(recvcheck.New()).
WithSince("v1.62.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
WithURL("https://github.com/raeperd/recvcheck"),

linter.NewConfig(revive.New(&cfg.LintersSettings.Revive)).
WithSince("v1.37.0").
WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
Expand Down
Loading