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: panic when using VS Code Live Share #41026

Closed
johanbrandhorst opened this issue Aug 25, 2020 · 3 comments
Closed

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

johanbrandhorst opened this issue Aug 25, 2020 · 3 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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@johanbrandhorst
Copy link
Member

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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/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/tools@v0.0.0-20200729181040-64cdafbe085c/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	/home/johan/go/pkg/mod/golang.org/x/tools@v0.0.0-20200729181040-64cdafbe085c/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/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
    golang.org/x/sync@v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
    golang.org/x/tools@v0.0.0-20200729181040-64cdafbe085c h1:jLQLIAedRoS9I2Py7l/ZAGGzUxLFsdg42JXEpS/a+ow=
    golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    honnef.co/go/tools@v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
    mvdan.cc/gofumpt@v0.0.0-20200709182408-4fd085cb6d5f h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
@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 Aug 25, 2020
@gopherbot gopherbot added this to the Unreleased milestone Aug 25, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v.0.5.0 Aug 25, 2020
@stamblerre
Copy link
Contributor

stamblerre commented Aug 26, 2020

gopls doesn't yet work with VSLS, but it definitely shouldn't panic. Can you confirm whether the crash reproduces with gopls at master (GO111MODULE=on go get golang.org/x/tools/gopls@master golang.org/x/tools@master)?

Edit: microsoft/vscode-go#3081 has some more background context on this.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 26, 2020
@johanbrandhorst
Copy link
Member Author

Looks like it's more graceful on master:

[Error - 10:53:57] Starting client failed
  Message: unsupported URI scheme: "vsls:/" (gopls only supports file URIs)
  Code: 0 

Thanks! I suppose we can keep this open until the next released is ready?

On separate note, are there any plans to support the vsls scheme? Should I open a separate issue?

Keep up the good work ❤️!

@johanbrandhorst
Copy link
Member Author

Ah, I just saw the edit, thank you, I will follow #31086.

@golang golang locked and limited conversation to collaborators Aug 26, 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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants