github.com/songshiyun/revive@v1.1.5-0.20220323112655-f8433a19b3c5/testdata/unreachable-code.go (about) 1 package fixtures 2 3 import ( 4 "fmt" 5 "log" 6 "os" 7 ) 8 9 func foo() int { 10 log.Fatalf("%s", "About to fail") // ignore 11 return 0 // MATCH /unreachable code after this statement/ 12 return 1 13 Println("unreachable") 14 } 15 16 func f() { 17 fmt.Println("Hello, playground") 18 if true { 19 return // MATCH /unreachable code after this statement/ 20 Println("unreachable") 21 os.Exit(2) // ignore 22 Println("also unreachable") 23 } 24 return // MATCH /unreachable code after this statement/ 25 fmt.Println("Bye, playground") 26 } 27 28 func g() { 29 fmt.Println("Hello, playground") 30 if true { 31 return // ignore if next stmt is labeled 32 label: 33 os.Exit(2) // ignore 34 } 35 36 fmt.Println("Bye, playground") 37 }