From 11cc3c157ee1e29a8c604e80168e2b80ddf7b9cf Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Thu, 22 Aug 2019 17:55:05 +0000 Subject: [PATCH] internal/lsp: add additional information when logging errors Fixes golang/go#33499 This logs additional information compatible with `golang.org/x/xerrors` like the frames. Change-Id: If25c3979cf294dbe55b0e3d9d999b24c1ff8900d GitHub-Last-Rev: 210fa40bd29de99a9052eb67d197154f4bd74e10 GitHub-Pull-Request: golang/tools#144 Reviewed-on: https://go-review.googlesource.com/c/tools/+/189344 Reviewed-by: Rebecca Stambler Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot --- internal/telemetry/event.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/telemetry/event.go b/internal/telemetry/event.go index 70905275cb7..88a3478db15 100644 --- a/internal/telemetry/event.go +++ b/internal/telemetry/event.go @@ -22,7 +22,11 @@ func (e Event) Format(f fmt.State, r rune) { } fmt.Fprint(f, e.Message) if e.Error != nil { - fmt.Fprintf(f, ": %v", e.Error) + if f.Flag('+') { + fmt.Fprintf(f, ": %+v", e.Error) + } else { + fmt.Fprintf(f, ": %v", e.Error) + } } for _, tag := range e.Tags { fmt.Fprintf(f, "\n\t%v = %v", tag.Key, tag.Value)