github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/juju/errors/example_test.go (about) 1 // Copyright 2013, 2014 Canonical Ltd. 2 // Licensed under the LGPLv3, see LICENCE file for details. 3 4 package errors_test 5 6 import ( 7 "fmt" 8 9 "github.com/insionng/yougam/libraries/juju/errors" 10 ) 11 12 func ExampleTrace() { 13 var err1 error = fmt.Errorf("something wicked this way comes") 14 var err2 error = nil 15 16 // Tracing a non nil error will return an error 17 fmt.Println(errors.Trace(err1)) 18 // Tracing nil will return nil 19 fmt.Println(errors.Trace(err2)) 20 21 // Output: something wicked this way comes 22 // <nil> 23 }