Skip to content

Commit 03dc54c

Browse files
committed
Use interface{} instead of any
1 parent 003fa08 commit 03dc54c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

testdata/src/a/a.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ func ComplexLogicalSeq5(a, b, c, d, e, f bool) bool { // want "cognitive complex
9999
return a && b && (c && d || e || f) // +1 for `&&` sequence, +2 for `&&` `||` sequence in parentheses
100100
} // total complexity = 3
101101

102-
func ExprFunc(a, b, c any) bool { // want "cognitive complexity 2 of func ExprFunc is high \\(> 0\\)"
102+
func ExprFunc(a, b, c interface{}) bool { // want "cognitive complexity 2 of func ExprFunc is high \\(> 0\\)"
103103
if a != nil || b != nil || c != nil { // +1 for `if`, +1 for `||` chain
104104
return false
105105
}
106106

107107
return true
108108
} // total complexity = 2
109109

110-
func VarFunc(a, b, c any) bool { // want "cognitive complexity 2 of func VarFunc is high \\(> 0\\)"
110+
func VarFunc(a, b, c interface{}) bool { // want "cognitive complexity 2 of func VarFunc is high \\(> 0\\)"
111111
na := a != nil
112112
nb := b != nil
113113
nc := c != nil

testdata/src/b/b.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"io"
77
)
88

9-
type any interface{}
10-
119
func HelloWorld() string {
1210
_ = len("hello")
1311
return "Hello, World!"
@@ -93,15 +91,15 @@ func ComplexLogicalSeq5(a, b, c, d, e, f bool) bool {
9391
return a && b && (c && d || e || f) // +1 for `&&` sequence, +2 for `&&` `||` sequence in parentheses
9492
} // total complexity = 3
9593

96-
func ExprFunc(a, b, c any) bool {
94+
func ExprFunc(a, b, c interface{}) bool {
9795
if a != nil || b != nil || c != nil { // +1 for `if`, +1 for `||` chain
9896
return false
9997
}
10098

10199
return true
102100
} // total complexity = 2
103101

104-
func VarFunc(a, b, c any) bool {
102+
func VarFunc(a, b, c interface{}) bool {
105103
na := a != nil
106104
nb := b != nil
107105
nc := c != nil

0 commit comments

Comments
 (0)