packagemainimport("fmt")funcmain(){varmyIntinterface{}=123k,ok:=myInt.(int)ifok{fmt.Println("Success:",k)}v,ok:=myInt.(float64)ifok{fmt.Println(v)}else{fmt.Println("Failed without panicking!")}
$ go run assertion.go
Success: 123
Failed without panicking!
No cheking: 123
panic: interface conversion: interface {} is int, not bool
goroutine 1 [running]:
main.main()
/Users/mtsouk/Desktop/masterGo/ch/ch7/code/assertion.go:25 +0x1d9
exit status 2