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: Using nil as protocol.ProgressToken will cause trouble #53288

Open
pjweinb opened this issue Jun 8, 2022 · 0 comments
Open

x/tools/gopls: Using nil as protocol.ProgressToken will cause trouble #53288

pjweinb opened this issue Jun 8, 2022 · 0 comments
Assignees
Labels
gopls Tools
Milestone

Comments

@pjweinb
Copy link

@pjweinb pjweinb commented Jun 8, 2022

Tracker.Start() is defined in internal/lps/progress/progress.go. Its fourth parameter is a protocol.ProgressToken. Although the Go type of ProgressToken is interface{}, the comments in tsprotocol.go (and in the LSP specification) say it must be either an integer or a string.

Most of the calls to Start() pass a nil value, which the code in Start() converts to a randomized string.

The proposed fix is to change the type of ProgressToken to string (which matches all its uses in gopls), replace the nil arguments with empty strings, and replace the test at line 89 of progress.go with a test for an empty string.

@gopherbot gopherbot added Tools gopls labels Jun 8, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jun 8, 2022
@pjweinb pjweinb self-assigned this Jun 8, 2022
@jamalc jamalc removed this from the Unreleased milestone Jun 8, 2022
@jamalc jamalc added this to the gopls/later milestone Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Tools
Projects
None yet
Development

No branches or pull requests

3 participants