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: "expected declaration, found 'package'" after cutting and pasting a file's contents #38424

stamblerre opened this issue Apr 13, 2020 · 2 comments


Copy link

@stamblerre stamblerre commented Apr 13, 2020

I've noticed that the go list empty file error message will sometimes reappear in this case. This needs both a fix and a regression test.

@gopherbot gopherbot added this to the Unreleased milestone Apr 13, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Apr 13, 2020
@stamblerre stamblerre changed the title x/tools/gopls: regression test for deleting a file's contents and returning it x/tools/gopls: "expected declaration, found 'package'" after cutting and pasting a file's contents May 5, 2020
Copy link

@segevfiner segevfiner commented Jun 23, 2020

I'm seeing this issue. Looks like something like starting with an empty file or removing it's content, then typing the package statement, waiting a bit, and continuing on to write some other stuff in the file, like a func main. Is this the gopls in memory representation of the file getting messed up or something?

Copy link

@gopherbot gopherbot commented Jul 20, 2020

Change mentions this issue: internal/lsp: handle deletion of file content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.