Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: panic on filenames containing % #36999
What did you do?
At some point, someone added a directory to our source tree that contained '%' characters.
This causes gopls to crash (the crash seems to be a recent development, since the directory has been there for about a year.)
You can reproduce this easily, at least on a Mac. I haven't tried this on Linux but I don't see why it wouldn't crash there too. Steps:
What did you expect to see?
'%' is a valid character in file paths, so gopls should have worked.
What did you see instead?
The editor reports that gopls has crashed multiple times and won't be restarted.
goroutine 50 [running]:
I did a little more digging. There are some problems with the way filenames are being URL-encoded. I've attached a patch that adds a testcase for this, and some updates to make the test pass. The problems are:
Sorry, I've committed a cretinous error and given you a backwards patch. Here's the same patch with the diff params in the right order.
We had previously worked around a VS Code URI bug by unescaping URIs. This is incorrect, so stop doing it and then add a specific workaround just for that one bug. Fixes golang/go#36999 Change-Id: I92f1a5f71749af7a6b1020eee1272586515f7084 Reviewed-on: https://go-review.googlesource.com/c/tools/+/217599 Run-TryBot: Rebecca Stambler <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Heschi Kreinick <email@example.com> (cherry picked from commit 35ac94b) Reviewed-on: https://go-review.googlesource.com/c/tools/+/217639