Pkg/errors 0.7.0 has been released

Hello,

github.com/pkg/errors 0.7.0 has been released. Although the semver tag downplays the scope of this release it brings some important (and wide ranging) improvements to the package.

The key change is the removal of the errors.Fprint helper, which nobody was very happy with. As a replacement all the types in this package now implement fmt.Formatter giving them the ability to print themselves with various levels of detail under control of the fmt package. For example

func main() {
        err := parseArgs(os.Args[1:])
        fmt.Printf("%+v\n", err)
}

Would output

not enough arguments, expected at least 3, got 0
main.parseArgs
        /home/dfc/src/github.com/pkg/errors/_examples/wrap/main.go:12
main.main
        /home/dfc/src/github.com/pkg/errors/_examples/wrap/main.go:18
runtime.main
        /home/dfc/go/src/runtime/proc.go:183
runtime.goexit
        /home/dfc/go/src/runtime/asm_amd64.s:2059

Feedback on this new mechanism, including nit picks on the format, is warmly requested via issues on the github project page.

Read the full release notes

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.