All Versions
Latest Version
Avg Release Cycle
149 days
Latest Release
1506 days ago

Changelog History

  • v0.9.1 Changes

    January 14, 2020

    ๐Ÿš€ pkg/errors 0.9.1 is a bug fix release for errors 0.9.0. This restore the previous behaviour on Cause method, this behaviour was changed on the PR: #215 and many breaking changes was produced by that.

  • v0.9.0 Changes

    January 12, 2020

    ๐Ÿš€ errors 0.9.0 is a preparation release for a 1.0 final release. Also we were working on removing support for Go 1.8, 1.9 and 1.10 and earlier, and become compatible this package with new way of errors on Go 1.13.

    ๐Ÿšš We tried to move into runtime.CallerFrames but this was not possible, you can show the explanation here: Issue 188.

    ๐Ÿ“ฆ The motivation for do the backward compatible this package with Go 1.13 is that you can migrate the easy way for this to the new way.

    Now you could use the methods, Is and As, and the Unwrap() interface like on the standard library.

    The method Cause is now compatible with fmt.Errorf("%w", err) and with the Unwrap() interface.

    ๐Ÿ“ฆ On the same way the methods related with wrapping on this package now are compatible with Cause and Unwrap() interface.

    ๐Ÿ‘Œ Improvements

    • .travis.yml Now use make file.
    • โฌ‡๏ธ reduce allocations when printing stack traces. Thanks @cstockton
    • โฌ‡๏ธ Reduce allocations in Stacktrace.Format
    • โž• Add Support to Go 1.13. Thanks @jayschwa, @Sherlock-Holo and @puellanivis.
    • โž• Add json.Marshaler support to the Frame type. Thanks @flimzy

    ๐Ÿ› Bugs fixed

    • .travis.yml Adjust Go versions. Thanks @komuw, @aperezg
    • ๐Ÿ–จ minor fix in an example to print Stack Trace. Thanks @bep.
    • โœ‚ Remove not necessary code.
    • ๐Ÿ“š Clean up documentation. Thanks @seh.
  • v0.8.1 Changes

    January 05, 2019

    ๐Ÿš€ pkg/errors 0.8.1 is a bug fix release for errors 0.8.0. It will be the last version to support Go 1.8 and below. pkg/errors 0.9 and above will require Go 1.9 for the new runtime.CallersFrames API.

    pkg/errors 0.8.1 also adds one new feature, errors.WithMessagef. Ideally this would be held over til 0.9, but that complicates the switch to runtime.CallersFrames.

    ๐Ÿ‘Œ Improvements

    • โž• Added errors.WithMessagef. Thanks @chemicL.

    ๐Ÿ› Bugs fixed

  • v0.8.0 Changes

    September 29, 2016

    What's new since version 0.7.1

    ๐Ÿ”€ errors 0.8.0 decomposes Wrap (and Wrapf) into their component operations, namely adding a message to an error, and adding a stack trace to an error, which were previously merged into a single operation.

    This is accomplished by adding two top level functions, errors.WithMessage and errors.WithStack, and rewriting Wrap and Wrapf in terms of these operations.

    The motivation for this change was need to treat each of the following operations as distinct:

    • Adding a context message to an existing error without altering the stack trace.
    • Adding a stack trace to an existing error without the requirement of adding an additional message.
    • Retrieving the immediate cause of an error; popping one element of the error stack.

    ๐Ÿ“ฆ The addition of WithStack and WithMessage increases the surface area of this package by two methods, after long discussions at GopherCon 2016 it was felt strongly that destructuring the operation of Wrap and Wrapf was necessary.

    ๐Ÿš€ For the moment Wrap and Wrapf remain, but depending on your feedback may be deprecated in future releases. Please leave comments via the issue link.

    ๐Ÿš€ Thanks to @nmiyake and @fabstu for their assistance in preparing this release.

    ๐Ÿ› Bug fixes

  • v0.7.1 Changes

    August 22, 2016

    What's new since version 0.7.0

    ๐Ÿ›  0.7.1 is a minor release in the 0.7 series which contains bugfixes, documentation improvements and cleanups and some internal refactoring.

    ๐Ÿ‘Œ Improvements

    • ๐Ÿ“„ Rename StackTrace interface to stacktracer in docs and examples.
    • Capitalise first letter of trace in examples. Thanks @jongillham
    • ๐Ÿ–จ Wrapped errors now print full stacktrace.
    • ๐Ÿ“š Documentation improvements, #69. Thanks @AlekSi
    • โž• Added benchmarks comparing stack trace performance. Fixes #72. Thanks @kardianos

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  Fix %q format for wrapped errors. Thanks @greensnark
    • โœ‚ Remove trailing newline from LICENSE file. Thanks @vbatts
    • โœ… Tests now pass when pkg/errors is vendored. Fixes #77. Thanks @exp
    • ๐Ÿ›  Fix the %q format for errors so it puts "" around the output (caused by a bug introduced between 0.7.0 and 0.7.1). Thanks @ncw
  • v0.7.0 Changes

    June 14, 2016

    What's new since version 0.6.0

    ๐Ÿ“ฆ 0.7.0 removes the deprecated errors.Location and errors.Stack interfaces, and the errors.Fprint helper. Types returned from this package now implement the fmt.Formatter interface and can print themselves when passed to fmt.Printf and friends.

    For example:

    • ๐Ÿ–จ fmt.Printf("%s\n", err) will print the message of the error as per normal, recursive if the underlying error has a Cause method.
    • ๐Ÿ–จ fmt.Printf(%v\n", err) operates the same as %s.
    • ๐Ÿ–จ fmt.Printf(%+v\n", err) prints the error message as above, then prints a stack trace of the point that the error was created with errors.New, errors.Errorf, etc.

    ๐Ÿ“ฆ This new behaviour is described in this blog post.

    Other changes in 0.7.0 include:

    • ๐Ÿ›  The Stacktrace() []Frame interface method was renamed to StackTrace() StackTrace. Please note the change in capitalisation. The previous interface was added in 0.6.0 so hopefully this change will not cause to many breaking changes. The name and signature of the method is not expected to change again in the future. Fixes #50.

    ๐Ÿ› Bug fixes

    • ๐Ÿ“ฆ incorrectly reported the licence of this package as MIT, not BSD 2 clause, this has been rectified. Thanks @anthonyfok. Fixes #41.
  • v0.6.0 Changes

    June 07, 2016

    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 the fmt.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) to fmt 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 deprecated Stack() []uintptr interface, implementations in this package now support a Stacktrace interface

      type Stacktrace interface { Stacktrace() []Frame}

    ๐Ÿ‘€ Calling this method returns a slice of Frame values, the most recent on the top. See #37

    • ๐Ÿ‘€ Frame values replace raw uintptr's (representing program counters) providing a type which implement the fmt.Formatter interface, which in turn exposes various aspect of a call frame (name, source file and line, etc) via the fmt package. See also #37
    • ๐Ÿ›  The name of the formal parameter to Wrap and Wrapf has been renamed from cause to err. This reflects the nature of these functions; to create a stack of errors. Apparently this also helps editor auto completion. Thanks @matryer. Fixes #32
  • v0.5.1 Changes

    May 24, 2016

    ๐Ÿ› Bugs fixed

    • ๐Ÿ›  Fix a bug whereby errors returned by New, Errorf, Wrap, Wrapf were not comparable with ==. Thanks to @stevvooe. Fixes #29
  • v0.5.0 Changes

    May 23, 2016

    What's new

    • New, Errorf, Wrap, and Wrapf, now store the stack trace of their caller (currently limited to a depth of 32). This can be retrieved by asserting for the following interface

      type Stack interface { Stack() []uintptr}

    The resulting []uintptr is the same format as runtime.Callers. At the moment there are no helpers to inspect this information.

  • v0.4.0 Changes

    May 11, 2016

    What's new

    • โœ‚ Remove the errors.Print helper, callers should use errors.Fprint(os.Stderr, err) as a replacement. See #23 for details
    • now has syntax highlighting. Thanks @mustafaakin
    • ๐Ÿ‘€ Package short description has been revised based. See #24 for details.