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: formatting code with a missing } rewrites function declaration #32698

Closed
dgryski opened this issue Jun 19, 2019 · 3 comments
Closed

Comments

@dgryski
Copy link
Contributor

@dgryski dgryski commented Jun 19, 2019

Every so often when I'm moving code around, I'll hit save (which formats) but the code I'm working on is incomplete: there's a missing }. Because of this, the function declaration following the one I'm currently working in changes from func (f *foo) Bar(a,b int,c string) error { to (func(f *foo)Bar(a,b,c))(). It looks like because gopls thinks it's still in a function and so tries to make that valid code?.

(I'm running VSCode 1.35.1 with 0.11.0 of the Go plugin. My gopls is from April 2nd, which I'm realizing is a bit out-of-date. I'll update my gopls and close this if I don't see it still happening..)

@gopherbot gopherbot added this to the Unreleased milestone Jun 19, 2019
@gopherbot gopherbot added the gopls label Jun 19, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: formatting code with a missing } rewrites function declaration x/tools/gopls: formatting code with a missing } rewrites function declaration Jul 2, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 5, 2019

Thanks for reporting! I filed #33479, which should hopefully lead to the resolution of this problem.

However, I'm not able to reproduce this in the Go playground: https://play.golang.org/p/_k32CGihMsA. Were you seeing this issue specifically on format or on import organization?

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 5, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Sep 5, 2019
@dgryski

This comment has been minimized.

Copy link
Contributor Author

@dgryski dgryski commented Sep 5, 2019

I haven't encountered this error again. Will reopen if I see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.