xerrors: avoid infinite loop in test (detailed).Error method
Fixes golang/go#40536
Change-Id: I5daaec48301cdedb2efcfadaf1dcd41cb8e96b01
Reviewed-on: https://go-review.googlesource.com/c/xerrors/+/246640
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/fmt_test.go b/fmt_test.go
index 7bf96a7..1e3c060 100644
--- a/fmt_test.go
+++ b/fmt_test.go
@@ -395,7 +395,7 @@
type detailed struct{}
-func (e detailed) Error() string { return fmt.Sprint(e) }
+func (e detailed) Error() string { panic("should have called FormatError") }
func (detailed) FormatError(p xerrors.Printer) (next error) {
p.Printf("out of %s", "peanuts")