Skip to content

Commit b49366d

Browse files
build(deps): bump github.com/uudashr/iface from 1.4.3 to 1.5.0 (#6595)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent 33bf679 commit b49366d

7 files changed

Lines changed: 44 additions & 8 deletions

File tree

.golangci.next.reference.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,6 +2050,7 @@ linters:
20502050
- unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined.
20512051
- opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation.
20522052
- unexported # Identifies interfaces that are not exported but are used in exported functions or methods.
2053+
- unusedmethod # Detects interface methods that are never used anywhere in the same package where they are defined.
20532054
settings:
20542055
unused:
20552056
# List of packages path to exclude from the check.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ require (
138138
github.com/ultraware/funlen v0.2.0
139139
github.com/ultraware/whitespace v0.2.0
140140
github.com/uudashr/gocognit v1.2.1
141-
github.com/uudashr/iface v1.4.3
141+
github.com/uudashr/iface v1.5.0
142142
github.com/valyala/quicktemplate v1.8.0
143143
github.com/xen0n/gosmopolitan v1.3.0
144144
github.com/yagipy/maintidx v1.0.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.

jsonschema/golangci.next.jsonschema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@
716716
"identical",
717717
"unused",
718718
"opaque",
719-
"unexported"
719+
"unexported",
720+
"unusedmethod"
720721
]
721722
},
722723
"tagliatelle-cases": {

pkg/golinters/iface/iface.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/uudashr/iface/opaque"
88
"github.com/uudashr/iface/unexported"
99
"github.com/uudashr/iface/unused"
10+
"github.com/uudashr/iface/unusedmethod"
1011
"golang.org/x/tools/go/analysis"
1112

1213
"github.com/golangci/golangci-lint/v2/pkg/config"
@@ -29,10 +30,11 @@ func New(settings *config.IfaceSettings) *goanalysis.Linter {
2930

3031
func analyzersFromSettings(settings *config.IfaceSettings) []*analysis.Analyzer {
3132
allAnalyzers := map[string]*analysis.Analyzer{
32-
"identical": identical.Analyzer,
33-
"unused": unused.Analyzer,
34-
"opaque": opaque.Analyzer,
35-
"unexported": unexported.Analyzer,
33+
"identical": identical.Analyzer,
34+
"unused": unused.Analyzer,
35+
"opaque": opaque.Analyzer,
36+
"unexported": unexported.Analyzer,
37+
"unusedmethod": unusedmethod.Analyzer,
3638
}
3739

3840
if settings == nil || len(settings.Enable) == 0 {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//golangcitest:args -Eiface
2+
//golangcitest:config_path testdata/iface_unusedmethod.yml
3+
package testdata
4+
5+
type MessageSender interface {
6+
SendMessage(username, msg string) error
7+
MustSendMessage(username, msg string) // want "method 'MustSendMessage\\(\\)' is declared on interface 'MessageSender' but not used within the package"
8+
9+
// Close the resource.
10+
Close() error // want "method 'Close\\(\\)' is declared on interface 'MessageSender' but not used within the package"
11+
}
12+
13+
type Service struct {
14+
sender MessageSender
15+
}
16+
17+
func NewService(sender MessageSender) *Service {
18+
return &Service{
19+
sender: sender,
20+
}
21+
}
22+
23+
func (s *Service) GreetMorning(username string) error {
24+
return s.sender.SendMessage(username, "Good morning")
25+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
3+
linters:
4+
settings:
5+
iface:
6+
enable:
7+
- unusedmethod

0 commit comments

Comments
 (0)