feat: error with stack on %#v (#461)

Print the error with stack when using %#v.

Fixes #363
This commit is contained in:
Steven Hartland
2022-11-27 23:12:50 +00:00
committed by GitHub
parent c4b94300e3
commit f76dda1760

View File

@@ -115,6 +115,12 @@ func (err Error) String() string {
return err.formatWithStack()
}
// GoString returns a description of the error and a trace of where the
// error occurred. Printing with %#v will trigger this behaviour.
func (err Error) GoString() string {
return err.formatWithStack()
}
func (err _error) describe(format string, in ...interface{}) string {
return fmt.Sprintf(format, in...)
}