github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/quickfix/qf1003/testdata/src/example.com/CheckIfElseToSwitch/CheckIfElseToSwitch.go (about) 1 package pkg 2 3 func fn() { 4 var x, y int 5 var z []int 6 var a bool 7 8 if x == 1 || x == 2 { //@ diag(`could use tagged switch on x`) 9 } else if x == 3 { 10 } 11 12 if x == 1 || x == 2 { //@ diag(`could use tagged switch on x`) 13 } else if x == 3 { 14 } else { 15 } 16 17 if x == 1 || x == 2 { 18 } else if y == 3 { 19 } else { 20 } 21 22 if a == (x == y) { //@ diag(`could use tagged switch on a`) 23 } else if a == (x != y) { 24 } 25 26 if z[0] == 1 || z[0] == 2 { //@ diag(`could use tagged switch on z[0]`) 27 } else if z[0] == 3 { 28 } 29 30 for { 31 if x == 1 || x == 2 { //@ diag(`could use tagged switch on x`) 32 } else if x == 3 { 33 } 34 } 35 36 for { 37 if x == 1 || x == 2 { 38 } else if x == 3 { 39 break 40 } 41 } 42 43 if x == 1 || x == 2 { 44 } 45 }