Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

errors: add Debug() function #97

Closed
wants to merge 2 commits into from
Closed

errors: add Debug() function #97

wants to merge 2 commits into from

Conversation

cyphar
Copy link

@cyphar cyphar commented Dec 16, 2016

This function allows users to use "%v" formatting everywhere, and then
dynamically decide whether they want to enable stack traces. If they
call errors.Debug(true) then "%v" formatting will return a stack trace,
otherwise it will be equivalent to "%s".

Fixes: #96
Signed-off-by: Aleksa Sarai asarai@suse.de

This function allows users to use "%v" formatting everywhere, and then
dynamically decide whether they want to enable stack traces. If they
call errors.Debug(true) then "%v" formatting will return a stack trace,
otherwise it will be equivalent to "%s".

Signed-off-by: Aleksa Sarai <asarai@suse.de>
@cyphar
Copy link
Author

cyphar commented Dec 16, 2016

I've also added tests which is basically a full copy of format_test.go with Debug(true) set in a few places.

This is effectively a copy of format_test.go, but with all of the "%v"
tests changed to be identical to "%+v" (which required changing all of
the line numbers).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
cyphar added a commit to opencontainers/umoci that referenced this pull request Dec 16, 2016
Include a backported version of pkg/errors#97, which adds the ability to
dynamically generate stacks if a user of "%v" formatting calls
errors.Debug(true).

Signed-off-by: Aleksa Sarai <asarai@suse.com>
@cyphar
Copy link
Author

cyphar commented Dec 16, 2016

/cc @davecheney

@davecheney
Copy link
Member

Closed because #96 is closed

@davecheney davecheney closed this Jan 6, 2019
@cyphar cyphar deleted the 96-add-dynamic-stack-output branch January 6, 2019 04:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants