Golang builtin.panic() function example
package builtin
The panic built-in function stops normal execution of the current goroutine......and can be controlled by the built-in function recover.
Golang builtin.panic() function usage example
package main
import "fmt"
func startPanic() {
defer func() {
fmt.Println("This will APPEAR")
}()
panic("noooo!")
}
func main() {
fmt.Println("Starting to panic...")
startPanic()
fmt.Println("This WILL NOT APPEAR ")
}
Output :
Starting to panic..
This will APPEAR
panic: noooo!
See also
http://golang.org/pkg/builtin/#recover
Reference :
Advertisement
Something interesting
Tutorials
+11.6k Android Studio : Create custom icons for your application example
+13.9k Golang : Human readable time elapsed format such as 5 days ago
+26.9k Golang : Force your program to run with root permissions
+7.3k Golang : File system scanning
+17.6k Convert JSON to CSV in Golang
+9.9k Golang : ffmpeg with os/exec.Command() returns non-zero status
+26.8k Golang : Find files by extension
+10.5k Swift : Convert (cast) String to Integer
+27.5k Golang : dial tcp: too many colons in address
+14.2k Golang : Convert IP version 6 address to integer or decimal number
+8.8k Golang : Get final balance from bit coin address example
+8.6k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared