Navigation Menu

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: index out of range panic with v0.3.4 #37977

Closed
hyangah opened this issue Mar 20, 2020 · 4 comments
Closed

x/tools/gopls: index out of range panic with v0.3.4 #37977

hyangah opened this issue Mar 20, 2020 · 4 comments
Labels
FrozenDueToAge 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

@hyangah
Copy link
Contributor

hyangah commented Mar 20, 2020

This happened when I reverted my change in 'go.mod, go.sum' and sync my workspace with the upstream master. This causes gopls crashes repeatedly and VS Code gave up restarting it eventually. After reloading the VS Code window, the problem went away. Not sure if I can reproduce it again but I hope the panic message should be clear enough to fix the crash.

 
go version 1.14
gopls version
----------
golang.org/x/tools/gopls v0.3.4
    golang.org/x/tools/gopls@v0.3.4 h1:4GC7q/pXQ/tsxHBGVdsMdlB4gCxVC06m/7rIXg1Px4E=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200316194252-fafb6e2e8a4a h1:hKrQy/q8/Xivoqgw6nGiz1jqpn1WGBLDcWLZwW0983E=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=
panic: runtime error: index out of range [18] with length 18

goroutine 8591 [running]:
golang.org/x/tools/internal/lsp/cache.goModWhy(0x1a12360, 0xc00d6ce6f0, 0xc011312280, 0xc0002a2727, 0x1b, 0xc000542310, 0x0, 0x0)
        /Users/hakim/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/cache/mod.go:227 +0x507
golang.org/x/tools/internal/lsp/cache.(*snapshot).ModHandle.func1(0x1a12360, 0xc00d6ce6f0, 0x0, 0x0)
        /Users/hakim/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/cache/mod.go:186 +0x6b8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0x1a122a0, 0xc005dcc600, 0xc00d2ea180, 0xc00d2ea1e0)
        /Users/hakim/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/memoize/memoize.go:216 +0x6b
created by golang.org/x/tools/internal/memoize.(*Handle).run
        /Users/hakim/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/memoize/memoize.go:210 +0x116
@gopherbot gopherbot added this to the Unreleased milestone Mar 20, 2020
@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 Mar 20, 2020
@jiacai2050
Copy link

Is there anyone working on this?

From my point of view, the check should be

	if len(whyList) <= 1 || len(whyList) < len(data.origParsedFile.Require) 

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 21, 2020
@stamblerre
Copy link
Contributor

stamblerre commented Mar 21, 2020

@ridersofrohan can confirm what the correct fix should be, but @jiacai2050, if you'd like to contribute a fix for this, please feel free to do so.

@gopherbot
Copy link

Change https://golang.org/cl/224591 mentions this issue: internal/lsp: return when whyList less than require.

@ridersofrohan
Copy link

ridersofrohan commented Mar 23, 2020

@jiacai2050 I think we can replace the < with !=. I added a comment on https://golang.org/cl/224591

Thanks for filing this fix!

jiacai2050 pushed a commit to jiacai2050/tools that referenced this issue Mar 24, 2020
@golang golang locked and limited conversation to collaborators Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

Successfully merging a pull request may close this issue.

5 participants