Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: Definition bug "no object for %s" (reported by telemetry) #64604

Closed
adonovan opened this issue Dec 7, 2023 · 3 comments
Closed
Assignees
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Dec 7, 2023

This stack DP-EWg was reported by telemetry:

Definition:94 is

		astObj := pgf.File.Scope.Lookup(obj.Name())
		if astObj == nil {
			// Every built-in should have documentation syntax.
			return nil, bug.Errorf("internal error: no object for %s", obj.Name())
		}

(This is not a dup of the recent issue #64086, though it may have been fixed by the same CL.)

gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Errorf:2
golang.org/x/tools/gopls/internal/lsp/source.Definition:94
golang.org/x/tools/gopls/internal/lsp.(*Server).definition:19
golang.org/x/tools/gopls/internal/lsp.(*Server).Definition:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:192
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.2 darwin/arm64 (1)

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

Dups:

This stack Qe6qGg was reported by telemetry:

gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Errorf:2
golang.org/x/tools/gopls/internal/lsp/source.Definition:94
golang.org/x/tools/gopls/internal/lsp.(*Server).definition:19
golang.org/x/tools/gopls/internal/lsp.(*Server).Definition:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:192
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1:52
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1:2
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2:3
runtime.goexit:0
golang.org/x/tools/gopls@v0.14.2 go1.20.4 darwin/arm64 (1)
@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. gopls/telemetry-wins labels Dec 7, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 7, 2023
@adonovan
Copy link
Member Author

I can't come up with a hypothesis for how obj can have no position, and be either in the Universe scope (= any built-in except error.Error) or in "unsafe", but not be defined in the corresponding {builtin,unsafe}.go source file.

@hyangah hyangah modified the milestones: Unreleased, gopls/v0.15.0 Dec 14, 2023
@adonovan
Copy link
Member Author

adonovan commented Feb 2, 2024

The only explanation I can come up with is that someone edited GOROOT/src/{unsafe/unsafe,builtin/builtin}.go to comment out a declaration, and then restarted gopls. It seems highly unlikely, but I can reproduce the bug this way, and "when you have eliminated all which is impossible...".

@adonovan adonovan self-assigned this Feb 2, 2024
@gopherbot
Copy link

Change https://go.dev/cl/560897 mentions this issue: gopls/internal/golang: downgrade bug.Reportf for missing builtin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants