Adds pretty error printing to the errors created by github.com/pkg/errors.
Minimal:
fmt.Printf("something went wrong:\n%s\n",
prettyerr.Format{err})With options:
fmt.Printf("something went wrong:\n%s\n",
prettyerr.Format{
Err: err,
Flags: prettyerr.FlagTesting,
Prefix: "TEST: ",
})Example output:
problem polishing widget: ran out of polish
Caused by: ran out of polish
at github.com/t11e/prettyerr_test.ExampleFormat ($GOPATH/src/github.com/t11e/prettyerr/prettyerr_test.go)
at testing.runExample ($GOROOT/src/testing/example.go)
at testing.runExamples ($GOROOT/src/testing/example.go)
at testing.(*M).Run ($GOROOT/src/testing/testing.go)
at main.main (github.com/t11e/prettyerr/_test/_testmain.go)
Read the package documentation for more information.
Clone this repository into your GOPATH and use dep to install its dependencies.
brew install dep
go get github.com/t11e/prettyerr
cd "$GOPATH"/src/github.com/t11e/prettyerr
dep ensureYou can then run the tests:
go test $(go list ./... | grep -v /vendor/)MIT. See LICENSE file.