-
Notifications
You must be signed in to change notification settings - Fork 764
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
gopls: time.Format with the bad format "2006-02-01" causes gopls to hang (new analyzer) #2406
Comments
Hi, thank you for reporting. I was not able to reproduce following your instructions. Can you please attach the panicking stack? (you can find this via |
Wait, I do believe I can reproduce: I don't get a crash, but rather a hanging process. I am investigating. |
Well, yes it is reliably reproducible, and only with that format. Almost certainly this is related to https://go.dev/cl/354010. Note that the format "2006-02-01" is likely wrong, per the discussion in https://go.dev/issue/48801. But of course it should not make gopls hang. CC @timothy-king (Tim: no action required from you, just keeping you informed that there may be a bug in this analyzer). Amazing that this was caught so soon. Thank you very much for filing an issue! |
The root cause is a debug print statement left in the analyzer, which breaks gopls' communication over stdin/stdout. |
Hit the same issue with |
Change https://go.dev/cl/422902 mentions this issue: |
Reopening and pinning until this is released. Since it is Friday, we likely won't cut a new release until Monday. |
Change https://go.dev/cl/422903 mentions this issue: |
…in the timeformat analyzer A debugging print statement was left in the analyzer, which breaks gopls' communication over stdin/stdout. Fix this, and add tests. Also add back the x/tools replace target, so that tests pass. For golang/vscode-go#2406 Change-Id: I1b785fa09e66eae2f1b1e03806e5b59d2015e75e Reviewed-on: https://go-review.googlesource.com/c/tools/+/422902 TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Tim King <[email protected]> (cherry picked from commit bebd890) Reviewed-on: https://go-review.googlesource.com/c/tools/+/422903 Reviewed-by: Suzy Mueller <[email protected]>
The fix for this issue will be released on Monday (we don't do releases late in the day on Friday, I'm afraid). In the meantime, anyone encountering this bug can take any one of the following mitigating steps:
|
Thank you for the quick verification and work on releasing a fix. |
This fix has been released in [email protected]. |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
go: /usr/local/bin/go: go version go1.19 darwin/amd64Go: Locate Configured Go Tools
command.gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: /Users/mbarri202/go/bin/dlv (version: v1.9.0 built with go: go1.19)
staticcheck: /Users/mbarri202/go/bin/staticcheck (version: v0.3.3 built with go: go1.19)
gopls: /Users/mbarri202/go/bin/gopls (version: v0.9.3 built with go: go1.19)
Describe the bug
Intellisense/gopls dies when using custom time format with time.Format. Go: Restart Language Server will work to restore functionality only if the offending code is removed or there are code errors preventing it from being run through. When the error occurs, hovering over text is stuck with a 'loading...' box, saving will hang on trying to access go formatting, and autocomplete will not function.
Steps to reproduce the behavior:
Go code that will cause the error:
now := time.Now()
nowFormatted := now.Format("2006-02-01")
fmt.Printf("Time: %v", nowFormatted)
Note that no error occurs with other time.Format functions such as
now.Format(time.RFC822)
. It seemed to only occur with this custom format.The text was updated successfully, but these errors were encountered: