November 2017
Intermediate to advanced
670 pages
17h 35m
English
Here is our HandlePanic() function:
func HandlePanic(err error) { if err != nil { _, filePath, lineNo, _ := runtime.Caller(1) _, fileName := path.Split(filePath) msg := fmt.Sprintf("[file:%s line:%d]: %s", fileName, lineNo, err.Error()) panic(msg) }}
It is worth noting that we import our utils package by prefacing it with a period like this:
import . "utils"
This allows us to reference public functions (starting with capital letters) without including the utils package name.