github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckScopedBreak.go (about) 1 package pkg 2 3 func fn() { 4 var ch chan int 5 for { 6 switch { 7 case true: 8 break // MATCH /ineffective break statement/ 9 default: 10 break // MATCH /ineffective break statement/ 11 } 12 } 13 14 for { 15 select { 16 case <-ch: 17 break // MATCH /ineffective break statement/ 18 } 19 } 20 21 for { 22 switch { 23 case true: 24 } 25 26 switch { 27 case true: 28 break // MATCH /ineffective break statement/ 29 } 30 31 switch { 32 case true: 33 } 34 } 35 36 for { 37 switch { 38 case true: 39 if true { 40 break // MATCH /ineffective break statement/ 41 } else { 42 break // MATCH /ineffective break statement/ 43 } 44 } 45 } 46 47 for { 48 switch { 49 case true: 50 if true { 51 break 52 } 53 54 println("do work") 55 } 56 } 57 58 label: 59 for { 60 switch { 61 case true: 62 break label 63 } 64 } 65 66 for range ([]int)(nil) { 67 switch { 68 default: 69 break // MATCH /ineffective break statement/ 70 } 71 } 72 }