errors v0.6.0 Release Notes
Release Date: 2016-06-07 // almost 8 years ago-
What's new since version 0.5.1
๐ The 0.6.0 release is a transitional release aimed at exposing the error's call stack, introduced in 0.5.0, to the caller.
๐ 0.6.0 is the last release that will support the
errors.Fprint
helper function. This function will be removed in version 0.7 and will be replaced with a more flexible option based on thefmt.Formatter
interface.๐ฆ Many thanks to @ChrisHines for inspiration, via his go-stack/stack package, and for his thoughtful review feedback.
๐ Deprecation notice
๐ The following symbols have been deprecated and will be removed in future releases.
- ๐
errors.Fprintf
will be removed in the 0.7 release. Read on for more details. The
Location
interface,type location interface { Location() (string, int) }
๐ is deprecated and will not be recognised in future releases. The replacement is
fmt.Sprintf("%+v", err.Stacktrace()[0])
๐จ That is, pass the topmost element of error's stack trace (assuming it has a
Stacktrace() []Frame
method) tofmt
and print it with the%+v
verb.The
Stack
interface,type stack interface { Stack() []uintptr}
๐ is deprecated and will not be recognised in future releases. Callers should use the new
Stacktrace
interface described below.๐ New features
๐ฆ
Stacktrace
interface. As a replacement for the deprecatedStack() []uintptr
interface, implementations in this package now support aStacktrace
interfacetype Stacktrace interface { Stacktrace() []Frame}
๐ Calling this method returns a slice of
Frame
values, the most recent on the top. See #37- ๐
Frame
values replace rawuintptr
's (representing program counters) providing a type which implement thefmt.Formatter
interface, which in turn exposes various aspect of a call frame (name, source file and line, etc) via thefmt
package. See also #37 - ๐ The name of the formal parameter to
Wrap
andWrapf
has been renamed fromcause
toerr
. This reflects the nature of these functions; to create a stack of errors. Apparently this also helps editor auto completion. Thanks @matryer. Fixes #32
- ๐