-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
344 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//golangcitest:args -Eiface | ||
package testdata | ||
|
||
// identical | ||
|
||
type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy" | ||
Ping() error | ||
} | ||
|
||
type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy" | ||
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 { // want "opaque: NewServer function return Server interface at the 1st result, abstract a single concrete implementation of \\*server" | ||
return &server{addr: addr} | ||
} | ||
|
||
// unused | ||
|
||
type User struct { | ||
ID string | ||
Name string | ||
} | ||
|
||
type UserRepository interface { // want "unused: interface UserRepository is declared but not used within the package" | ||
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 interface{}) { | ||
_ = x.(Allower) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//golangcitest:args -Eiface | ||
//golangcitest:config_path testdata/iface_identical.yml | ||
package testdata | ||
|
||
// identical | ||
|
||
type Pinger interface { // want "identical: interface Pinger contains identical methods or type constraints from another interface, causing redundancy" | ||
Ping() error | ||
} | ||
|
||
type Healthcheck interface { // want "identical: interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy" | ||
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 interface{}) { | ||
_ = x.(Allower) | ||
} |
File renamed without changes.
Oops, something went wrong.