mirror of https://github.com/golang/go.git
internal/lsp/cache: fix some package event tags
Package.ID() is far more useful to tag on events, as it disambiguates multiple packages with the same path. Change-Id: I03fd69f64641eb17155ca72ed2ef19641b75f004 Reviewed-on: https://go-review.googlesource.com/c/tools/+/279722 Run-TryBot: Robert Findley <rfindley@google.com> Trust: 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>
This commit is contained in:
parent
9cbb1efa77
commit
f6952e403d
|
|
@ -207,7 +207,7 @@ func runAnalysis(ctx context.Context, snapshot *snapshot, analyzer *analysis.Ana
|
|||
}
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
event.Log(ctx, fmt.Sprintf("analysis panicked: %s", r), tag.Package.Of(pkg.PkgPath()))
|
||||
event.Log(ctx, fmt.Sprintf("analysis panicked: %s", r), tag.Package.Of(pkg.ID()))
|
||||
data.err = errors.Errorf("analysis %s for package %s panicked: %v", analyzer.Name, pkg.PkgPath(), r)
|
||||
}
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -141,7 +141,10 @@ func (s *snapshot) load(ctx context.Context, allowNetwork bool, scopes ...interf
|
|||
}
|
||||
for _, pkg := range pkgs {
|
||||
if !containsDir || s.view.Options().VerboseOutput {
|
||||
event.Log(ctx, "go/packages.Load", tag.Snapshot.Of(s.ID()), tag.PackagePath.Of(pkg.PkgPath), tag.Files.Of(pkg.CompiledGoFiles))
|
||||
event.Log(ctx, "go/packages.Load",
|
||||
tag.Snapshot.Of(s.ID()),
|
||||
tag.Package.Of(pkg.ID),
|
||||
tag.Files.Of(pkg.CompiledGoFiles))
|
||||
}
|
||||
// Ignore packages with no sources, since we will never be able to
|
||||
// correctly invalidate that metadata.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ var (
|
|||
File = keys.NewString("file", "")
|
||||
Directory = keys.New("directory", "")
|
||||
URI = keys.New("URI", "")
|
||||
Package = keys.NewString("package", "")
|
||||
Package = keys.NewString("package", "") // Package ID
|
||||
PackagePath = keys.NewString("package_path", "")
|
||||
Query = keys.New("query", "")
|
||||
Snapshot = keys.NewUInt64("snapshot", "")
|
||||
|
|
|
|||
Loading…
Reference in New Issue