Debian Codegraph @

staticcheck/sa6005/testdata/go1.0/CheckToLowerToUpperComparison/CheckToLowerToUpperComparison.go

raw
1 package pkg
2
3 import "strings"
4
5 func fn() {
6 const (
7 s1 = "foo"
8 s2 = "bar"
9 )
10
11 if strings.ToLower(s1) == strings.ToLower(s2) { //@ diag(`should use strings.EqualFold instead`)
12 panic("")
13 }
14
15 if strings.ToUpper(s1) == strings.ToUpper(s2) { //@ diag(`should use strings.EqualFold instead`)
16 panic("")
17 }
18
19 if strings.ToLower(s1) != strings.ToLower(s2) { //@ diag(`should use strings.EqualFold instead`)
20 panic("")
21 }
22
23 switch strings.ToLower(s1) == strings.ToLower(s2) { //@ diag(`should use strings.EqualFold instead`)
24 case true, false:
25 panic("")
26 }
27
28 if strings.ToLower(s1) == strings.ToLower(s2) || s1+s2 == s2+s1 { //@ diag(`should use strings.EqualFold instead`)
29 panic("")
30 }
31
32 if strings.ToLower(s1) > strings.ToLower(s2) {
33 panic("")
34 }
35
36 if strings.ToLower(s1) < strings.ToLower(s2) {
37 panic("")
38 }
39
40 if strings.ToLower(s1) == strings.ToUpper(s2) {
41 panic("")
42 }
43 }