mirror of https://github.com/golang/go.git
internal/lsp: put verbose go/packages output behind verboseOutput flag
On startup gopls runs go/packages over the entire workspace. The log message in question outputs each package found along with all the package's filenames. Obviously in a large project this produces an incredible amount of output. Fix by putting the log message behind the "verboseOutput" flag when invoking go/packages in the "dir/..." mode. I also added the go/packages "query" string to the once-per-go-packages-call log message so it is more useful. Change-Id: I651419e34a855325056bca6720eda8671f7d5fa8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/210739 Run-TryBot: Muir Manders <muir@mnd.rs> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
bdebc07e97
commit
56b0b28a00
|
|
@ -62,7 +62,7 @@ func (s *snapshot) load(ctx context.Context, scope source.Scope) ([]*metadata, e
|
|||
if err == context.Canceled {
|
||||
return nil, errors.Errorf("no metadata for %s: %v", uri, err)
|
||||
}
|
||||
log.Print(ctx, "go/packages.Load", tag.Of("packages", len(pkgs)))
|
||||
log.Print(ctx, "go/packages.Load", tag.Of("query", query), tag.Of("packages", len(pkgs)))
|
||||
if len(pkgs) == 0 {
|
||||
if err == nil {
|
||||
err = errors.Errorf("no packages found for query %s", query)
|
||||
|
|
@ -120,7 +120,9 @@ func (c *cache) shouldLoad(ctx context.Context, s *snapshot, originalFH, current
|
|||
func (s *snapshot) updateMetadata(ctx context.Context, uri source.Scope, pkgs []*packages.Package, cfg *packages.Config) ([]*metadata, error) {
|
||||
var results []*metadata
|
||||
for _, pkg := range pkgs {
|
||||
log.Print(ctx, "go/packages.Load", tag.Of("package", pkg.PkgPath), tag.Of("files", pkg.CompiledGoFiles))
|
||||
if _, isDir := uri.(source.DirectoryURI); !isDir || s.view.Options().VerboseOutput {
|
||||
log.Print(ctx, "go/packages.Load", tag.Of("package", pkg.PkgPath), tag.Of("files", pkg.CompiledGoFiles))
|
||||
}
|
||||
|
||||
// Set the metadata for this package.
|
||||
if err := s.updateImports(ctx, packagePath(pkg.PkgPath), pkg, cfg, map[packageID]struct{}{}); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue