attest
attest copied to clipboard
proposal: print errors using "%+v"
Currently errors in attest.Ok() are printed using t.Printf("error: %v", err). This proposal is to change that to t.Printf("error: %+v", err).
The rationale is, there are some 3rd party error libraries that add stack traces to their errors, for those they mostly use the + flag when you want to print the error and the trace.
Examples:
pkg/errors; https://github.com/pkg/errors/blob/5dd12d0cfe7f152f80558d591504ce685299311e/errors.go#L127-L132cockroachdb/errors; https://github.com/cockroachdb/errors/blob/c1cc1919cf999fb018fcd038852e969e3d5631cc/withstack/stack.go#L29-L36- others; https://github.com/search?q=Flag%28%27%2B%27%29+language%3AGo++NOT+is%3Aarchived+&type=code
This issue is not about encouraging people to use error packages with stack traces, it is about improving the experience of those who do. Additionally people who do not use stack traces are not negatively affected by the change and finally it is not a huge change to the attest library.
Sounds like a reasonable approach to me. Can you open a PR?
opened; https://github.com/akshayjshah/attest/pull/17
Friendly ping @akshayjshah