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: panic during completion in go template (crash) #68416

Closed
dnywonnt opened this issue Jul 14, 2024 · 3 comments
Closed

x/tools/gopls: panic during completion in go template (crash) #68416

dnywonnt opened this issue Jul 14, 2024 · 3 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@dnywonnt
Copy link

gopls version: v0.16.1/go1.22.0
gopls flags:
update flags: proxy
extension version: 0.41.4
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Sun, 14 Jul 2024 07:29:06 GMT
restart history:
Sun, 14 Jul 2024 05:00:06 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: slice bounds out of range [91:90]

goroutine 118 [running]:
golang.org/x/tools/gopls/internal/template.(*completer).complete(0xc0028b32c0)
	  completion.go:117  0xd25
golang.org/x/tools/gopls/internal/template.Completion({0xc0007e1980%3F, 0x5a%3F}, 0x8%3F, {0x131daa0, 0xc001b380c0}, {0x50d688%3F, 0xc0%3F}, {0x1, {0x0, 0x0}})
	  completion.go:56  0x308
golang.org/x/tools/gopls/internal/server.(*server).Completion(0xc00020c600, {0x131c608, 0xc000451230}, 0xc0002ee5a0)
	  completion.go:54  0x499
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x131c640, 0xc00054c550}, {0x1337cd0, 0xc00020c600}, 0xc000375cb0, {0x131c800, 0xc00036af00})
	  tsserver.go:361  0x2587
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x131c640, 0xc00054c550}, 0xc000375cb0, {0x131c800, 0xc00036af00})
	  protocol.go:160  0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x131c640, 0xc00054c550}, 0xc000375cb0, {0x131c800, 0xc00036af00})
	  lsprpc.go:509  0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x131c640, 0xc00054c550}, 0xc00019d020, {0x131c800, 0xc00036af00})
	  handler.go:35  0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
	  handler.go:103  0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 96
	  handler.go:100  0x1c5
gopls stats -anon { "DirStats": { "Files": 134, "TestdataFiles": 0, "GoFiles": 40, "ModFiles": 1, "Dirs": 76 }, "GOARCH": "amd64", "GOOS": "linux", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.0", "GoplsVersion": "v0.16.1", "InitialWorkspaceLoadDuration": "813.282514ms", "MemStats": { "HeapAlloc": 34401120, "HeapInUse": 52289536, "TotalAlloc": 579967608 }, "WorkspaceStats": { "Files": { "Total": 2107, "Largest": 935931, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.0", "AllPackages": { "Packages": 338, "LargestPackage": 161, "CompiledGoFiles": 2103, "Modules": 53 }, "WorkspacePackages": { "Packages": 14, "LargestPackage": 5, "CompiledGoFiles": 40, "Modules": 1 }, "Diagnostics": 0 } ] } }

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

@hyangah
Copy link
Contributor

hyangah commented Jul 15, 2024

Thanks for the report!
Transferring to the gopls issue tracker.
@dnywonnt In the mean time, can you share code snippet or more details on the completion request made when you observed this issue? That will help us reproduce the problem.

@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: panic during completion in go template (crash) Jul 15, 2024
@hyangah hyangah transferred this issue from golang/vscode-go Jul 15, 2024
@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 Jul 15, 2024
@gopherbot gopherbot added this to the Unreleased milestone Jul 15, 2024
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.17.0 Jul 15, 2024
@adonovan
Copy link
Member

Dup of #57621

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants