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: invalid range bug in source.FindParam (reported by telemetry) #64544

Closed
adonovan opened this issue Dec 4, 2023 · 2 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 4, 2023

This stack 73LKtQ was reported by telemetry:

	start, end, err := pgf.RangePos(rng)
	if err != nil {
		bug.Reportf("(file=%v).RangePos(%v) failed: %v", pgf.URI, rng, err)
		return info
	}
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/source.FindParam:4
golang.org/x/tools/gopls/internal/lsp.canRemoveParameter:1
golang.org/x/tools/gopls/internal/lsp.refactorRewrite:14
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction:220
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:142
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.19.8 windows/amd64 (3)

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

@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 4, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 4, 2023
@hyangah hyangah modified the milestones: Unreleased, gopls/v0.15.0 Dec 7, 2023
@adonovan
Copy link
Member Author

This indicates that an invalid Range was supplied, and at least one of its start/end positions has a line or column number that is beyond EOF, or, less likely, indicates a position on a line containing a UTF-8 encoding error.

I think the bug.Report is erroneous, and FindParam should return an "invalid position" error.

@adonovan adonovan self-assigned this Dec 11, 2023
@gopherbot
Copy link

Change https://go.dev/cl/548738 mentions this issue: gopls/internal: don't bug.Report when given an invalid position

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