github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckIneffectiveLoop.go (about) 1 package pkg 2 3 func fn() { 4 for { 5 if true { 6 println() 7 } 8 break // MATCH /the surrounding loop is unconditionally terminated/ 9 } 10 for { 11 if true { 12 break 13 } else { 14 break 15 } 16 } 17 for range ([]int)(nil) { 18 if true { 19 println() 20 } 21 break // MATCH /the surrounding loop is unconditionally terminated/ 22 } 23 for range (map[int]int)(nil) { 24 if true { 25 println() 26 } 27 break 28 } 29 for { 30 if true { 31 goto Label 32 } 33 break 34 Label: 35 } 36 for { 37 if true { 38 continue 39 } 40 break 41 } 42 for { 43 if true { 44 continue 45 } 46 break 47 } 48 }