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/internal/regtest/completion: failures with "line is beyond end of file" in TestPackageCompletion/package_completion_for_empty_file #50140

Closed
bcmills opened this issue Dec 13, 2021 · 2 comments
Labels
gopls/completion Issues related to auto-completion in gopls. gopls/corruption Issues related to file corruption in gopls gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Dec 13, 2021

--- FAIL: TestPackageCompletion (7.66s)
    --- FAIL: TestPackageCompletion/package_completion_for_empty_file (0.78s)
        --- FAIL: TestPackageCompletion/package_completion_for_empty_file/singleton (0.37s)
            completion_test.go:180: line is beyond end of file 1
FAIL
FAIL	golang.org/x/tools/gopls/internal/regtest/completion	22.211s

greplogs --dashboard -md -l -e 'line is beyond end of file'

2021-12-09T15:47:16-27fc764-f1f3923/linux-386
2021-09-28T20:53:23-64bbad1-7d57324/linux-amd64-race
2021-09-21T00:59:42-d2417d5-986f8ea/linux-amd64-race
2021-08-03T19:59:22-32c652e-7921829/linux-amd64-nocgo
2021-06-07T18:10:59-716319f-ab7f829/linux-386-clang
2021-04-27T02:39:52-e3dc99f-434e12f/freebsd-amd64-12_2

CC @findleyr

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Dec 13, 2021
@gopherbot gopherbot added this to the Unreleased milestone Dec 13, 2021
@hyangah hyangah added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 14, 2021
@findleyr findleyr added Testing An issue that has been verified to require only test changes, not just a test failure. gopls/completion Issues related to auto-completion in gopls. and removed gopls/testing labels May 10, 2022
@findleyr
Copy link
Contributor

This doesn't appear to have reoccurred in 2022, but I am absolutely stumped at how this could be possible.

The request comes in with position (0, 0)
Params: {"context":{"triggerKind":0},"textDocument":{"uri":"file:///workdir/tmp/gopls-regtest-886539363/TestPackageCompletion/package_completion_for_empty_file/singleton/work/fruits/testfile4.go"},"position":{"line":0,"character":0}}

As far as I can tell, the only place where we encounter this error message (from ToOffset) should be in converting this position:
https://cs.opensource.google/go/x/tools/+/master:internal/lsp/source/completion/package.go;l=39;drc=0fb1abf25a5f88a5791bd57a7084b3e61952f637

golang.org/x/tools/internal/lsp/protocol.(*ColumnMapper).Point(0x7e?, {0x54a7f0?, 0xc0?})
        /home/rfindley/src/tools/internal/lsp/protocol/span.go:105 +0x27
golang.org/x/tools/internal/lsp/protocol.(*ColumnMapper).PointSpan(0xc000827170, {0x1088980?, 0x0?})
        /home/rfindley/src/tools/internal/lsp/protocol/span.go:97 +0x4e
golang.org/x/tools/internal/lsp/source/completion.packageClauseCompletions({0x1087d40, 0xc0008269f0}, {0x10928a8?, 0xc000828000}, {0x1088980, 0xc00054a780?}, {0x7e?, 0x0?})
        /home/rfindley/src/tools/internal/lsp/source/completion/package.go:38 +0xc5
golang.org/x/tools/internal/lsp/source/completion.Completion({0x1087c98?, 0xc0006b62c0?}, {0x10928a8?, 0xc000828000?}, {0x1088980?, 0xc00054a780?}, {0x64d310?, 0xc0?}, {0x0, {0x0, ...}})
        /home/rfindley/src/tools/internal/lsp/source/completion/completion.go:434 +0x1b9
golang.org/x/tools/internal/lsp.(*Server).completion(0xcba860?, {0x1087c98, 0xc0006b62c0}, 0xc0007f6460)

But that should be absolutely deterministic. Somehow 1 > 1...

@findleyr findleyr added the gopls/corruption Issues related to file corruption in gopls label May 17, 2022
@findleyr
Copy link
Contributor

findleyr commented Sep 7, 2023

Too much of this code has changed for us to ever get to this, as without evidence we can assume it is obsolete. Closing.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/completion Issues related to auto-completion in gopls. gopls/corruption Issues related to file corruption in gopls gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants