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/cmd/gopls: crashes with "slice bounds out of range" #31707

zippoxer opened this issue Apr 26, 2019 · 2 comments

x/tools/cmd/gopls: crashes with "slice bounds out of range" #31707

zippoxer opened this issue Apr 26, 2019 · 2 comments


Copy link

@zippoxer zippoxer commented Apr 26, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.4 windows/amd64

Does this issue reproduce with the latest release?

Yes. VSCode is up to date, and I updated gopls moments before.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\User\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\User\go
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set GOMOD=C:\Users\User\projects\devout\go.mod
set CGO_CFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\User\AppData\Local\Temp\go-build351004186=/tmp/go-build -gno-record-gcc-switches

What did you do?

Edit the file below (in a sub-package of a project which has go.mod), place my caret at the position marked with [[*]], and press CTRL + Space to get suggestions.

package httpserver

import (


func (s *Server) apiRouter() chi.Router {
	r := chi.NewRouter()

	r.Post("/search", s.handleSearch)

	return r

func (s *Server) handleSearch(r http.[[*]])

What did you expect to see?


What did you see instead?

This error, repeatedly, until VSCode tires and stops restarting gopls:

cacheAndDiagnose: file:///c:/Users/User/projects/devout/httpserver/api.go
cacheAndDiagnose: set content for file:///c:/Users/User/projects/devout/httpserver/api.go
cacheAndDiagnose: returned from diagnostics for file:///c:/Users/User/projects/devout/httpserver/api.go
cacheAndDiagnose: going to get diagnostics for file:///c:/Users/User/projects/devout/httpserver/api.go
found parse or type-checking errors for file:///c:/Users/User/projects/devout/httpserver/api.go, returning
panic: runtime error: slice bounds out of range

goroutine 19 [running]:, 0x29, 0xe0, 0xc0001c2380, 0xe0, 0xe0, 0x1, 0x0, 0x0)
	C:/Users/User/go/src/ +0x581*ColumnMapper).Position(0xc00d2c00f0, 0x11, 0x29, 0xe0, 0x4030000000000000, 0x0, 0x0, 0x0)
	C:/Users/User/go/src/ +0x6a*ColumnMapper).Range(0xc00d2c00f0, 0xc002b98fc0, 0x38, 0x11, 0x1, 0xb8, 0x11, 0x29, 0xe0, 0x4020000000000000, ...)
	C:/Users/User/go/src/ +0x4b7, 0xc005376900, 0x2, 0x2, 0xc005376900, 0x2, 0x2)
	C:/Users/User/go/src/ +0x267*Server).documentSymbol(0xc0000aa7e0, 0x8d06c0, 0xc000068e80, 0xc00004c010, 0xc00004c010, 0x0, 0x0, 0x0, 0xc00020e000)
	C:/Users/User/go/src/ +0x17e*Server).DocumentSymbol(0xc0000aa7e0, 0x8d06c0, 0xc000068e80, 0xc00004c010, 0xc00004c010, 0x0, 0x0, 0x0, 0x0)
	C:/Users/User/go/src/ +0x54, 0xc000068e80, 0xc0001443f0, 0xc000063320)
	C:/Users/User/go/src/ +0x42b1*Conn).Run.func1(0xc00009e840, 0xc0001443f0)
	C:/Users/User/go/src/ +0xe1
created by*Conn).Run
	C:/Users/User/go/src/ +0xc1
[Info  - 2:41:22 AM] Connection to server got closed. Server will restart.


This bug doesn't happen when the handleSearch function has a body:

func (s *Server) handleSearch(r http.[[*]]) {}
@gopherbot gopherbot added this to the Unreleased milestone Apr 26, 2019
@gopherbot gopherbot added the gopls label Apr 26, 2019
Copy link

@stamblerre stamblerre commented Apr 27, 2019

Copy link

@stamblerre stamblerre commented Apr 29, 2019 will likely have fixed this error. Please re-open if you see it again.

@stamblerre stamblerre closed this Apr 29, 2019
@golang golang locked and limited conversation to collaborators Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.