Skip to content

x/tools/gopls: "unexpected files in command-line-arguments package" bug (via telemetry) #64557

Open
@adonovan

Description

@adonovan
#!stacks
"bug.Reportf" &&
  ("cache.buildMetadata:+19" ||
   "cache.buildMetadata:+16" && !"buildMetadata:+166" /* sigh; see #71045 */ || 
   "cache.buildMetadata:+14")

Yay! Repro at #64557 (comment)

This stacks EVz2Fg, ELG5Yw, ND0D7A were reported by telemetry:

// buildMetadata populates the updates map with metadata updates to
// apply, based on the given pkg. It recurs through pkg.Imports to ensure that
// metadata exists for all dependencies.
func buildMetadata(updates map[PackageID]*metadata.Package, pkg *packages.Package, loadDir string, standalone bool) {
	// Allow for multiple ad-hoc packages in the workspace (see #47584).
	pkgPath := PackagePath(pkg.PkgPath)
	id := PackageID(pkg.ID)

	if metadata.IsCommandLineArguments(id) {
		if len(pkg.CompiledGoFiles) != 1 {
			bug.Reportf("unexpected files in command-line-arguments package: %v", pkg.CompiledGoFiles)
			return
gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Reportf:1
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:7
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).load:173
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).MetadataForFile:36
golang.org/x/tools/gopls/internal/lsp/source.NarrowestMetadataForFile:1
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseChangedFiles:28
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseSnapshot:25
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseSnapshots.func1:2
runtime.goexit:0
golang.org/x/tools/gopls@v0.14.2 go1.21.0 darwin/arm64 (6)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

Duplicates:

This stack dDf6yw was reported by telemetry:

gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Reportf:1
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:7
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).load:173
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).MetadataForFile:36
golang.org/x/tools/gopls/internal/lsp/source.selectPackageForFile:1
golang.org/x/tools/gopls/internal/lsp/source.NarrowestPackageForFile:1
golang.org/x/tools/gopls/internal/lsp/source.SignatureHelp:6
golang.org/x/tools/gopls/internal/lsp.(*Server).signatureHelp:9
golang.org/x/tools/gopls/internal/lsp.(*Server).SignatureHelp:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:490
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.handshaker.func4:52
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.MustReplyHandler.func1:2
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.AsyncHandler.func2.2:3
runtime.goexit:0
golang.org/x/tools/gopls@v0.14.2 go1.21.6 windows/amd64 vscode (1)

This stack Es6nFQ was reported by telemetry:

gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Reportf:1
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:7
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:143
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).load:173
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).MetadataForFile:36
golang.org/x/tools/gopls/internal/lsp/source.NarrowestMetadataForFile:1
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseChangedFiles:28
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseSnapshot:25
golang.org/x/tools/gopls/internal/lsp.(*Server).diagnoseSnapshots.func1:2
runtime.goexit:0
golang.org/x/tools/gopls@v0.14.2 go1.21.3 darwin/arm64 vscode (1)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

This stack OBhdqw was reported by telemetry:

gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Reportf:1
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:7
golang.org/x/tools/gopls/internal/lsp/cache.buildMetadata:143
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).load:173
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).MetadataForFile:36
golang.org/x/tools/gopls/internal/lsp/source.NarrowestMetadataForFile:1
golang.org/x/tools/gopls/internal/lsp.(*commandHandler).ListImports.func1:25
golang.org/x/tools/gopls/internal/lsp.(*commandHandler).run.func1:2
golang.org/x/tools/gopls/internal/lsp.(*commandHandler).run:72
golang.org/x/tools/gopls/internal/lsp.(*commandHandler).ListImports:2
golang.org/x/tools/gopls/internal/lsp/command.Dispatch:73
golang.org/x/tools/gopls/internal/lsp.(*Server).executeCommand:19
golang.org/x/tools/gopls/internal/lsp.(*Server).ExecuteCommand:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:606
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls@v0.14.2 go1.21.3 darwin/arm64 vscode (1)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

Dups: gRw1-A ibW47g Dfhd-g _p1kkQ RcEuHA fJJ7HA e0uUFg 9M1npA WNZ--Q SmQ1mg v1Eb2g DdP2cQ 5Um4Rg yWpCHQ ziMhMQ 49eF6g rAKLNA bm9HIg EOWgnA ajbd5g 4Kmr1A ztITlA LmpcWQ daD0Wg NrjaNg ci33qA iVSJBQ bune9w xVlXmw IGBQ2g a847Cw muJADA 8CXaKA oiyrYw zC-moA iimguA Mvdo3A wgZHRw

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions