1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

internal/lsp: log snapshot IDs, don't log context cancellation

Updates golang/go#36772

Change-Id: Id6f1be9511f37865d5c6efcff10230e03724b27d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216497
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-01-26 16:05:01 -05:00
parent f3a16861ae
commit 0576458154
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,8 @@ func (s *Server) diagnose(ctx context.Context, snapshot source.Snapshot) {
ctx, done := trace.StartSpan(ctx, "lsp:background-worker")
defer done()
ctx = telemetry.Snapshot.With(ctx, snapshot.ID())
// Diagnose all of the packages in the workspace.
go func() {
wsPackages, err := snapshot.WorkspacePackages(ctx)
@ -148,7 +150,9 @@ func (s *Server) publishReports(ctx context.Context, snapshot source.Snapshot, r
URI: protocol.NewURI(fileID.URI),
Version: fileID.Version,
}); err != nil {
log.Error(ctx, "publishReports: failed to deliver diagnostic", err, telemetry.File)
if ctx.Err() == nil {
log.Error(ctx, "publishReports: failed to deliver diagnostic", err, telemetry.File)
}
continue
}
// Update the delivered map.

View File

@ -25,6 +25,7 @@ const (
Package = tag.Key("package")
PackagePath = tag.Key("package_path")
Query = tag.Key("query")
Snapshot = tag.Key("snapshot")
)
var (