Skip to content

build(deps): bump github.com/uudashr/iface from 1.3.2 to 1.4.0 #5820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2025
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
1 change: 1 addition & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,7 @@ linters:
- identical # Identifies interfaces in the same package that have identical method sets.
- unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined.
- opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation.
- unexported # Identifies interfaces that are not exported but are used in exported functions or methods.
settings:
unused:
# List of packages path to exclude from the check.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ require (
github.com/ultraware/funlen v0.2.0
github.com/ultraware/whitespace v0.2.0
github.com/uudashr/gocognit v1.2.0
github.com/uudashr/iface v1.3.2
github.com/uudashr/iface v1.4.0
github.com/valyala/quicktemplate v1.8.0
github.com/xen0n/gosmopolitan v1.3.0
github.com/yagipy/maintidx v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

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

3 changes: 2 additions & 1 deletion jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@
"enum": [
"identical",
"unused",
"opaque"
"opaque",
"unexported"
]
},
"tagliatelle-cases": {
Expand Down
8 changes: 5 additions & 3 deletions pkg/golinters/iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/uudashr/iface/identical"
"github.com/uudashr/iface/opaque"
"github.com/uudashr/iface/unexported"
"github.com/uudashr/iface/unused"
"golang.org/x/tools/go/analysis"

Expand All @@ -28,9 +29,10 @@ func New(settings *config.IfaceSettings) *goanalysis.Linter {

func analyzersFromSettings(settings *config.IfaceSettings) []*analysis.Analyzer {
allAnalyzers := map[string]*analysis.Analyzer{
"identical": identical.Analyzer,
"unused": unused.Analyzer,
"opaque": opaque.Analyzer,
"identical": identical.Analyzer,
"unused": unused.Analyzer,
"opaque": opaque.Analyzer,
"unexported": unexported.Analyzer,
}

if settings == nil || len(settings.Enable) == 0 {
Expand Down
8 changes: 4 additions & 4 deletions pkg/golinters/iface/testdata/iface_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import "fmt"

// identical

type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy"
type Pinger interface { // want "identical: interface 'Pinger' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy"
type Healthcheck interface { // want "identical: interface 'Healthcheck' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

Expand All @@ -28,7 +28,7 @@ func (s server) Serve() error {
return nil
}

func NewServer(addr string) Server { // want "opaque: NewServer function return Server interface at the 1st result, abstract a single concrete implementation of \\*server"
func NewServer(addr string) Server { // want "opaque: 'NewServer' function return 'Server' interface at the 1st result, abstract a single concrete implementation of '\\*server'"
return &server{addr: addr}
}

Expand All @@ -39,7 +39,7 @@ type User struct {
Name string
}

type UserRepository interface { // want "unused: interface UserRepository is declared but not used within the package"
type UserRepository interface { // want "unused: interface 'UserRepository' is declared but not used within the package"
UserOf(id string) (*User, error)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/golinters/iface/testdata/iface_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ func _() {

// identical

type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy"
type Pinger interface { // want "identical: interface 'Pinger' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy"
type Healthcheck interface { // want "identical: interface 'Healthcheck' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/golinters/iface/testdata/iface_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import "fmt"

// identical

type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy"
type Pinger interface { // want "identical: interface 'Pinger' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy"
type Healthcheck interface { // want "identical: interface 'Healthcheck' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/golinters/iface/testdata/iface_identical.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import "fmt"

// identical

type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy"
type Pinger interface { // want "identical: interface 'Pinger' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy"
type Healthcheck interface { // want "identical: interface 'Healthcheck' contains identical methods or type constraints with another interface, causing redundancy"
Ping() error
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/iface/testdata/iface_opaque.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s server) Serve() error {
return nil
}

func NewServer(addr string) Server { // want "opaque: NewServer function return Server interface at the 1st result, abstract a single concrete implementation of \\*server"
func NewServer(addr string) Server { // want "opaque: 'NewServer' function return 'Server' interface at the 1st result, abstract a single concrete implementation of '\\*server'"
return &server{addr: addr}
}

Expand Down
84 changes: 84 additions & 0 deletions pkg/golinters/iface/testdata/iface_unexported.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//golangcitest:args -Eiface
//golangcitest:config_path testdata/iface_unexported.yml
package testdata

import "fmt"

// identical

type Pinger interface {
Ping() error
}

type Healthcheck interface {
Ping() error
}

// opaque

type Server interface {
Serve() error
}

type server struct {
addr string
}

func (s server) Serve() error {
return nil
}

func NewServer(addr string) Server {
return &server{addr: addr}
}

// unused

type User struct {
ID string
Name string
}

type UserRepository interface {
UserOf(id string) (*User, error)
}

type UserRepositorySQL struct {
}

func (r *UserRepositorySQL) UserOf(id string) (*User, error) {
return nil, nil
}

type Granter interface {
Grant(permission string) error
}

func AllowAll(g Granter) error {
return g.Grant("all")
}

type Allower interface {
Allow(permission string) error
}

func Allow(x any) {
_ = x.(Allower)
fmt.Println("allow")
}

// unexported

type unexportedReader interface {
Read([]byte) (int, error)
}

func ReadAll(r unexportedReader) ([]byte, error) { // want "unexported interface 'unexportedReader' used as parameter in exported function 'ReadAll'"
buf := make([]byte, 1024)
_, err := r.Read(buf)
return buf, err
}

func NewUnexportedReader() unexportedReader { // want "unexported interface 'unexportedReader' used as return value in exported function 'NewUnexportedReader'"
return nil // stub
}
7 changes: 7 additions & 0 deletions pkg/golinters/iface/testdata/iface_unexported.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "2"

linters:
settings:
iface:
enable:
- unexported
6 changes: 3 additions & 3 deletions pkg/golinters/iface/testdata/iface_unused.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import "fmt"

// identical

type Pinger interface { // want "unused: interface Pinger is declared but not used within the package"
type Pinger interface { // want "unused: interface 'Pinger' is declared but not used within the package"
Ping() error
}

type Healthcheck interface { // want "unused: interface Healthcheck is declared but not used within the package"
type Healthcheck interface { // want "unused: interface 'Healthcheck' is declared but not used within the package"
Ping() error
}

Expand Down Expand Up @@ -39,7 +39,7 @@ type User struct {
Name string
}

type UserRepository interface { // want "unused: interface UserRepository is declared but not used within the package"
type UserRepository interface { // want "unused: interface 'UserRepository' is declared but not used within the package"
UserOf(id string) (*User, error)
}

Expand Down
Loading