Skip to content

x/tools/gopls: panic when using VS Code Live Share #41026

@johanbrandhorst

Description

@johanbrandhorst

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

$ go version
go version go1.15 linux/amd64

Does this issue reproduce with the latest release?

It reproduces with 0.4.4

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/johan/.cache/go-build"
GOENV="/home/johan/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/johan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/johan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build086447167=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Joined a VS Code Live Share session with gopls enabled.

What did you expect to see?

No crash, and ideally able to work with the remove files

What did you see instead?

A panic with the following debug output:

Go info
-------
go version go1.15 linux/amd64

panic: only file URIs are supported, got "vsls" from "vsls:/"

goroutine 91 [running]:
golang.org/x/tools/internal/span.URI.Filename(...)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/span/uri.go:32
golang.org/x/tools/internal/lsp/cache.(*View).setBuildInformation(0xc0004a8000, 0xea8ac0, 0xc000247b60, 0xc00042dd90, 0x6, 0xc000260000, 0x3f, 0x3f, 0x1, 0x1, ...)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/cache/view.go:814 +0x5a6
golang.org/x/tools/internal/lsp/cache.(*Session).createView(0xc000225520, 0xea8ac0, 0xc000247b60, 0xc00042dd98, 0x8, 0xc00042dd90, 0x6, 0x4000000000000000, 0x10101, 0xc00042dcf0, ...)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/cache/session.go:163 +0x4f8
golang.org/x/tools/internal/lsp/cache.(*Session).NewView(0xc000225520, 0xea8ac0, 0xc000247b60, 0xc00042dd98, 0x8, 0xc00042dd90, 0x6, 0x4000000000000000, 0x10101, 0xc00042dcf0, ...)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/cache/session.go:113 +0x12b
golang.org/x/tools/internal/lsp.(*Server).addView(0xc00021f580, 0xea8ac0, 0xc000247b60, 0xc00042dd98, 0x8, 0xc00042dd90, 0x6, 0xc00023f800, 0xa, 0x10, ...)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/workspace.go:41 +0x1f5
golang.org/x/tools/internal/lsp.(*Server).addFolders(0xc00021f580, 0xea8ac0, 0xc000247b60, 0xc0002f5880, 0x1, 0x4, 0x0, 0x0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/general.go:206 +0x23c
golang.org/x/tools/internal/lsp.(*Server).initialized(0xc00021f580, 0xea8ac0, 0xc000247b60, 0x13204f8, 0x0, 0x0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/general.go:157 +0x385
golang.org/x/tools/internal/lsp.(*Server).Initialized(0xc00021f580, 0xea8ac0, 0xc000247b60, 0x13204f8, 0x13204f8, 0x0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/server_gen.go:112 +0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xea8ac0, 0xc000247b60, 0xebbf80, 0xc00021f580, 0xc000466cf0, 0x7f1d002d39b0, 0xc000247b00, 0xe963e0, 0xc0002e09a0, 0xea8ac0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/tsserver.go:92 +0x662
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xea8ac0, 0xc000247b60, 0xc000466cf0, 0x7f1d002d39b0, 0xc000247b00, 0x12eeba0, 0xea6d80)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/protocol.go:62 +0xc5
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xea8ac0, 0xc000247b60, 0xc000466cf0, 0x7f1d002d39b0, 0xc000247b00, 0x0, 0x0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/lsprpc/lsprpc.go:521 +0x432
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xea8ac0, 0xc000247b60, 0xc000240fc0, 0x7f1d002d39b0, 0xc000247b00, 0x0, 0x0)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:35 +0xcf
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc00020eba0, 0xc000247f80, 0xc000207820, 0xea8ac0, 0xc000247b60, 0xc000240fc0, 0x7f1d002d39b0, 0xc000247b00)
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	/home/johan/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:100 +0x173
[Info  - 16:00:03] Connection to server got closed. Server will restart.
[Info  - 16:00:03] 2020/08/25 16:00:03 Build info
----------
golang.org/x/tools/gopls 0.4.4
    golang.org/x/tools/[email protected] h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=
    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/[email protected] h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
    golang.org/x/[email protected] h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
    golang.org/x/[email protected] h1:jLQLIAedRoS9I2Py7l/ZAGGzUxLFsdg42JXEpS/a+ow=
    golang.org/x/[email protected] h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    honnef.co/go/[email protected] h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
    mvdan.cc/[email protected] h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE=
    mvdan.cc/xurls/[email protected] h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions