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

gopls: automated issue report (crash) #3351

Closed
Devinwong opened this issue Apr 19, 2024 · 2 comments
Closed

gopls: automated issue report (crash) #3351

Devinwong opened this issue Apr 19, 2024 · 2 comments
Milestone

Comments

@Devinwong
Copy link

gopls version: v0.15.3/go1.22.2
gopls flags:
update flags: proxy
extension version: 0.41.2
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Fri, 19 Apr 2024 21:41:19 GMT
restart history:
Fri, 19 Apr 2024 21:36:39 GMT: activation (enabled: true)
Fri, 19 Apr 2024 21:37:51 GMT: installation (enabled: true)
Fri, 19 Apr 2024 21:40:34 GMT: installation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

  1. Run VS code
  2. Press F1 to install/ update tools, and select gopls@latest
  3. See successful message: Installing golang.org/x/tools/gopls@latest (/home/devinwon/go/bin/gopls) SUCCEEDED
  4. After a short while like 30 seconds, a notification VS code pops up saying the connection to gopls has been closed. The gopls server may have crashed
panic: runtime error: slice bounds out of range [:-1]

goroutine 19961 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc01b4b55c0, 0x1, 0x0)
	  mapper.go:151  0x1ad
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0x0, 0x0}, {0xc009e3b680, 0x60}, 0x1}, 0x60%3F, {0x128b8c0, 0xc00d0aa5a0}, {0x1293d20, 0xc0170e7450})
	  errors.go:58  0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0x1293d20, 0xc0170e7450}, {{0x0, 0x0}, {0xc009e3b680, 0x60}, 0x1}, 0xc00d7fcf00, {0x128b8c0, 0xc00d0aa5a0})
	  errors.go:69  0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0x1293d20, 0xc0170e7450}, 0xc00d0aa5a0, 0xc00d7fcf00)
	  load.go:541  0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc015eb7200, {0x1293d20, 0xc0170e7450}, 0xc016f366e0)
	  check.go:1129  0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
	  check.go:932  0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
	  errgroup.go:78  0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 18971
	  errgroup.go:75  0x96
gopls stats -anon gopls stats -anon failed after 7640 ms. Please check if gopls is killed by OS.

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>

@Devinwong
Copy link
Author

My project is very huge and consists of many packages. I worked around this by adding a go.work file in the root, and added one of the package I am focused on to that go.work. Then gopls doesn't complain. So wondering if it's because the project is too huge?

@findleyr
Copy link
Member

@Devinwong I think this crash is due to processing of one specific error message.
This looks like a dupe of golang/go#66875, and #3352 seems to have a reliable reproducer.
I will send a fix. Closing this as a dupe.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants