aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/debug
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2021-05-10 11:22:03 -0400
committerRobert Findley <rfindley@google.com>2021-05-10 23:22:37 +0000
commit79d39ff544a3eea8246545cccc8add1739703f51 (patch)
tree5c8428ffe602f5bd215e163972235aea3d6c7f95 /internal/lsp/debug
parentfa055457156641b311b331af56f3d2b3b4d103af (diff)
downloadgolang-x-tools-79d39ff544a3eea8246545cccc8add1739703f51.tar.gz
internal/lsp/source/completion: avoid a panic in package completion
For golang/vscode-go#1486 Change-Id: I48939224778155964712192faf5a437ee10cd2e1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/318370 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Diffstat (limited to 'internal/lsp/debug')
-rw-r--r--internal/lsp/debug/serve.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/internal/lsp/debug/serve.go b/internal/lsp/debug/serve.go
index d7dd5445d..b3699e18c 100644
--- a/internal/lsp/debug/serve.go
+++ b/internal/lsp/debug/serve.go
@@ -82,15 +82,14 @@ type State struct {
bugs map[string]string
}
-func Bug(ctx context.Context, desc string) {
- labels := [3]label.Label{
- tag.Bug.Of(desc),
- }
+func Bug(ctx context.Context, desc, format string, args ...interface{}) {
+ labels := []label.Label{tag.Bug.Of(desc)}
_, file, line, ok := runtime.Caller(1)
if ok {
- labels[1] = tag.Callsite.Of(fmt.Sprintf("%s:%d", file, line))
+ labels = append(labels, tag.Callsite.Of(fmt.Sprintf("%s:%d", file, line)))
}
- core.Export(ctx, core.MakeEvent(labels, nil))
+ msg := fmt.Sprintf(format, args...)
+ event.Log(ctx, msg, labels...)
}
type bug struct {