Commit Graph

160 Commits (master)

Author SHA1 Message Date
santosh653 5dd12d0cfe
AddingPowerSupport_CI/Testing (#234)
* Update .travis.yml

Adding Power & Updating the go versions to 1.13/1.14/1.15 as lower versions are not supported.

* Update .travis.yml

Removing go 1.13 as desired in the comment section,

* Update .travis.yml

As desired taking out the power(ppc64le) related support.,
2020-12-14 17:45:52 +11:00
Adrian Perez 614d223910
Revert "Support Go 1.13 error chains in `Cause` (#215)" (#220)
This reverts commit 49f8f61729.
2020-01-14 20:47:44 +01:00
Jay Petacat 49f8f61729 Support Go 1.13 error chains in `Cause` (#215) 2020-01-07 22:33:24 +01:00
Adrian Perez 004deef562
remove unnecessary use of fmt.Sprintf (#217)
* remove unnecessary use of fmt.Sprintf
2020-01-03 13:36:54 +01:00
Sherlock Holo 6d954f502e feat: support std errors functions (#213)
* feat: support std errors functions

add function `Is`, `As` and `Unwrap`, like std errors, so that we can
continue to use pkg/errors with go1.13 compatibility

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* style: delete useless comments

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* build: update makefile

update makefile to download dependencies before test anything

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* build: fix makefile

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* chore: delete useless comments

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Restore Makefile

* revert: revert some change

some change are doing by PR #206 and #212 , so I don't need to do it

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* test: add more check for As unit test

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* revert: only support Is As Unwrap for >=go1.13

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* feat(Unwrap): allow <go1.13 can use Unwrap

`Unwrap` just use type assert, it doesn't need go1.13 actually

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* test: add go1.13 errors compatibility check

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* refactor(Unwrap): don't allow <go1.13 use Unwrap

If we implement Unwrap ourselves, may create a risk of incompatibility
if Go 1.14 subtly changes its `Unwrap` implementation.
<go1.13 users doesn't have `Is` or `As`, if they want, they will use
xerrors and it also provides `Unwrap`

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>
2020-01-03 12:25:31 +01:00
Jay Petacat 7f95ac13ed Add support for Go 1.13 error chains (#206)
* Add support for Go 1.13 error chains

Go 1.13 adds support for error chains to the standard libary's errors
package. The new standard library functions require an Unwrap method to
be provided by an error type. This change adds a new Unwrap method
(identical to the existing Cause method) to the unexported error types.
2019-11-09 11:23:16 +01:00
aperezg 91f169312d travis.yml: add Go 1.13 2019-11-09 09:33:42 +01:00
aperezg ca0248e19b fix travis, 1.10 doesnt support by unconvert anymore 2019-11-09 09:33:42 +01:00
Dave Cheney 27936f6d90
travis.yml: add Go 1.12 (#200)
Also deprecate Go 1.9

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-02-27 11:00:51 +11:00
Jonathan Hall 856c240a51 Add json.Marshaler support to the Frame type. (#197)
* Add json.Marshaler support to the Frame type.

* Update regex for Go tip

* Escape periods in regular expression tests

* Implement encoding.TextMarshaler instead of json.Marshaler
2019-02-18 09:52:12 +11:00
Dave Cheney ffb6e22f01
Reduce allocations in StackTrace.Format (#194)
Updates #150

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-09 17:16:28 +11:00
Dave Cheney 565c8d0e97
Merge pull request #193 from pkg/fixedbugs/188
Return errors.Frame to a uintptr
2019-01-09 15:45:28 +11:00
Dave Cheney e9933c1c09 Restore performance improvements from #150 2019-01-09 15:37:53 +11:00
Dave Cheney ee1923e96d Return errors.Frame to a uintptr
Updates aws/aws-xray-sdk-go#77
Updates evalphobia/logrus_sentry#74

Go 1.12 has updated the behaviour of runtime.FuncForPC so that it
behaves as it did in Go 1.11 and earlier.

This allows errors.Frame to return to a uintptr representing the PC +1
of the caller. This will fix the build breakages of projects that were
tracking HEAD of this package.

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-09 15:30:26 +11:00
Keith Randall 72fa05efae errors: detect unknown frames correctly (#192)
With Go 1.12, we will now be doing mid-stack inlining. This exposes
inlined frames to runtime.Callers and friends.

The spec says that a runtime.Frame may have a nil Func field for
inlined functions. Instead, use the Function field to detect whether
we really have an empty Frame.
2019-01-09 11:58:33 +11:00
Dave Cheney c38ea53d8c
Remove errors.Frame to runtime.Frame conversions (#189)
Avoid the unnecessary conversions from errors.Frame to
runtime.Frame to access the latter's fields as by definition the former
also has the same fields.

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-06 12:53:32 +11:00
Dave Cheney c9e70be240
Makefile: switch to staticcheck (#187)
Remove deprecated linters that have been rolled into staticcheck.

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 22:04:53 +11:00
Dave Cheney 998beafa93 Merge branch 'cstockton-master' 2019-01-05 21:51:05 +11:00
Dave Cheney ee4766c291 Fix error during merge
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 21:50:40 +11:00
Dave Cheney 25793cafd5 Merge branch 'master' of ssh://github.com/cstockton/errors into cstockton-master 2019-01-05 21:40:34 +11:00
Dave Cheney 584cbace28
Remove checks for old style anon funcs (#186)
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 21:07:35 +11:00
Dave Cheney 42ce1b6a12
Remove Frame methods (#185)
errors.Frame is convertable from/to a runtime.Frame and know how to
print itself.

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 20:05:53 +11:00
Dave Cheney 308074fef0 Merge branch 'bep-patch-1' 2019-01-05 19:54:34 +11:00
Dave Cheney 937e8c5528 gofmt -w
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:54:25 +11:00
Dave Cheney c1bc528f85
Merge branch 'master' into patch-1 2019-01-05 19:50:32 +11:00
Dave Cheney e19cb699ad
Remove last reference to runtime.FuncForPC (#184)
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:41:10 +11:00
Dave Cheney 4f47277723
Switch to runtime.CallersFrames (#183)
Fixes #160
Fixes #107

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:23:03 +11:00
Dave Cheney 537896ad6e
travis: remove Go 1.8 and earlier (#182)
Remove support for Go 1.8 and earlier as they are

a. no longer supported upstream
b. lack support for runtime.CallerFrames

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 15:00:06 +11:00
Dave Cheney 31aac83bad
travis: use Makefile (#181)
Add a bunch of useful makefile targets

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 14:54:17 +11:00
Dave Cheney 5ac96aea29
Update README.md 2019-01-05 13:32:11 +11:00
Tariq Ibrahim ba968bfe8b gofmt -w errors.go (#179) 2019-01-03 17:52:24 +11:00
Komu Wairagu 059132a15d Update .travis.yml (#168) 2018-10-24 10:59:46 +11:00
Harald Nordgren d58f942510 Bump Travis versions (#172) 2018-10-21 09:29:33 +11:00
Bjørn Erik Pedersen 6ed0a2e59e
Fix StackTrace print example 2018-10-14 16:58:47 +02:00
Steven E. Harris 2233dee583 Copyedit the package documentation (#135)
Remove spurious words, add missing words, and smooth out a few
sentences.
2018-10-08 15:53:15 +11:00
Dariusz Jedrzejczyk e981d1a2c5 Add WithMessagef function (#118)
WithMessagef utility function to accompany WithMessage, similar to
exiting Wrapf function accompanying Wrap.
2018-10-08 15:50:16 +11:00
Eldar Rakhimberdin c059e472ca fixed spelling (#156) 2018-09-11 16:21:13 +10:00
Dave Cheney 816c908556
travis.yml: add Go 1.10 (#154) 2018-03-12 08:45:15 +11:00
Chris Stockton e1ac100e46 reduce allocations when printing stack traces (#149) 2018-02-17 10:57:01 -07:00
Mark Ayers 30136e27e2 Remove deadcode (#146) 2018-01-27 12:58:12 +11:00
Tom Sweeney e881fd58d7 Fix minor typo in README.md (#142)
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-12-16 18:03:16 +11:00
Nick Snyder 8842a6e0cc Add badge for number of dependent libraries (#109) 2017-12-10 13:24:16 +11:00
Tibor Benke e4f5060297 Fix doc comment for exported Format func (#137)
Fixes #136

Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2017-12-10 10:30:25 +11:00
haya14busa f15c970de5 Remove an unused argument of utility test func (#139)
Found this by https://github.com/mvdan/unparam
2017-10-19 06:55:49 +11:00
Davor Kapsa 2b3a18b5f0 travis: add 1.9.x to go versions (#133) 2017-09-10 23:46:14 +10:00
Matthew Hardwick c605e284fe Add doc comment for exported Format func (#115) 2017-05-05 14:36:39 +10:00
Alexey Palazhchenko ff09b135c2 Bump Go versions, use latest patch releases (#110) 2017-03-17 07:15:38 +11:00
Bradley Falzon bfd5150e4e Move benchmark assigned err to global exported variable (#106)
toperr is not used, but the go compiler itself doesn't detect this
because it's within an anonymous function. However, go/types does
detect this as being unused, which causes any static analysis tools
which uses go/types' type checker to fail with the message "toperr
assigned and not used".

The final result of the benchmarked function is instead assigned to
an exported global variable to ensure the compiler cannot now, nor
in the future optimise away the function calls due to no observable
side effects.

It was chosen to assign the final result, after the benchmark loop,
to the global variable, as this best follows the example set in the
CL https://go-review.googlesource.com/#/c/37195/. As opposed to
having each call to f assign to the global. This also appears to
better align with the original author's intention of toperr.

This change had no observable impact on the benchmark.

Related https://github.com/golang/go/issues/3059.
Related https://github.com/golang/go/issues/8560.

Thanks dominikh for additional clarifications.
2017-02-28 09:00:37 +11:00
Alexey Palazhchenko 248dadf4e9 Bump Go versions (#91) 2016-10-29 20:36:37 +11:00
Nick Miyake 839d9e913e Fix minor newline consistency issues in test files (#87) 2016-10-02 16:25:12 +11:00