Closed
Description
Can't compile a function with no return after panic.
IMHO, adding the 'panic' clause after 'throw' in the following example is a dead code and should be omitted.
package main
import "fmt"
func throw(message string){
panic(message)
}
func foo(value int) int{
switch value {
case 1:
return 2
case 3:
return 4
}
throw("Can't do this!")
//panic("Can't do this!") // uncomment this to compile.
}
func main() {
fmt.Printf("Hello world: %v", foo(1))
}
expected: code compiles.
got: ./test.go:18: missing return at end of function
version:
go version go1.5.1 darwin/amd64
go version go1.5.1 windows/amd64