Description
What version of Go are you using (go version
)?
$ go version go version go1.12.5 linux/amd64
What version of gopls are you using ?
$ gopls version golang.org/x/tools/gopls v0.1.3 golang.org/x/tools/gopls@(devel)
What is the output of gopls -rpc.trace -v check /path/to/file.go?
gopls -rpc.trace -v check hello.go
Output
$ gopls -rpc.trace -v check hello.go2019/08/21 17:54:53 Info:2019/08/21 17:54:53 Build info
golang.org/x/tools/gopls v0.1.3
golang.org/x/tools/gopls@(devel)
golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/tools@v0.0.0-20190723021737-8bb11ff117ca => ../
golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=Go info
go version go1.12.5 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/suzmue/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/suzmue/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/google-golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/suzmue/rename-bug/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build017984367=/tmp/go-build -gno-record-gcc-switches"
2019/08/21 17:54:54 Info:2019/08/21 17:54:54 go/packages.Load
packages = 1
2019/08/21 17:54:54 Info:2019/08/21 17:54:54 go/packages.Load
package = hello
files = [/usr/local/google/home/suzmue/rename-bug/hello.go]
What did you do?
Using Vscode with gopls and triggered a completion in the import spec:
package hello
import "fmt" // trigger rename on fmt
func _() {
fmt.Println("Hello")
}
What did you see?
gopls crashed:
Log:
[Error - 5:47:35 PM] Request textDocument/rename failed.
Message: method "textDocument/rename" did not reply
Code: -32603
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x8b60e8]
goroutine 1683 [running]:
golang.org/x/tools/internal/lsp/source.(*IdentifierInfo).Rename(0xc000e2a8f0, 0xcebce0, 0xc00204b800, 0xc001498d70, 0x4, 0x0, 0x0, 0x0)
/usr/local/google/home/suzmue/tools/internal/lsp/source/rename.go:50 +0x118
golang.org/x/tools/internal/lsp.(*Server).rename(0xc00022c0a0, 0xcebce0, 0xc001fe9dd0, 0xc00204b680, 0x0, 0x0, 0xc0025bf860)
/usr/local/google/home/suzmue/tools/internal/lsp/rename.go:38 +0x2e0
golang.org/x/tools/internal/lsp.(*Server).Rename(0xc00022c0a0, 0xcebce0, 0xc001fe9dd0, 0xc00204b680, 0xc00204b680, 0x0, 0x0)
/usr/local/google/home/suzmue/tools/internal/lsp/server.go:254 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0xcfd660, 0xc00022c0a0, 0xcebce0, 0xc001fe9dd0, 0xc0020fcf40, 0xc001fe9d00, 0xc00212e550)
/usr/local/google/home/suzmue/tools/internal/lsp/protocol/tsserver.go:466 +0xf68
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc00024f140, 0xc0020fcf40, 0xc000222a20, 0xcebce0, 0xc001fe9dd0, 0x0, 0x0, 0xc000d70cf0)
/usr/local/google/home/suzmue/tools/internal/jsonrpc2/jsonrpc2.go:370 +0x13a
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
/usr/local/google/home/suzmue/tools/internal/jsonrpc2/jsonrpc2.go:354 +0x8d8
Activity
gopherbot commentedon Aug 21, 2019
Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here.
gopherbot commentedon Aug 21, 2019
Change https://golang.org/cl/191163 mentions this issue:
internal/lsp: return error when renaming within an import spec