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: cmd.(*connection).AddFile crashes when given a nonexistent file #33445

Closed
kylelemons opened this issue Aug 3, 2019 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Milestone

Comments

@kylelemons
Copy link
Contributor

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

Go info
-------
go version go1.12.7 windows/amd64

set GOARCH=arm
set GOBIN=
set GOCACHE=C:\Users\kyle\AppData\Local\go-build
set GOEXE=
set GOFLAGS=-tags=gameboyadvance,arm7tdmi
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=linux
set GOPATH=C:\Users\kyle\dev\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set GOARM=7
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\kyle\dev\tinygo_gba\tinygo\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -marm -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\kyle\AppData\Local\Temp\go-build043604590=/tmp/go-build -gno-record-gcc-switches

Does this issue reproduce with the latest release?

2019/08/02 18:11:03 Info:Build info
----------
golang.org/x/tools/gopls v0.1.2
    golang.org/x/tools/gopls@v0.1.3 h1:CB5ECiPysqZrwxcyRjN+exyZpY0gODTZvNiqQi3lpeo=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20190710153321-831012c29e42 h1:4IOeC7p+OItq3+O5BWkcmVu2uBe3jekXau5S4QZX9DU=

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

What did you do?

GOFLAGS=-tags=gameboyadvance,arm7tdmi GOOS=linux GOARCH=arm GOARM=7 gopls -rpc.trace -v check tinygo/src/machine/machine_gameboyadvance.go

What did you expect to see?

I accidentally forgot to chop off the prefix of the file I was passing to gopls check when cd'ing into a subdirectory, and instead of an error, I got a panic stack trace.

So, I expect a failure telling me that tinygo/src/machine/machine_gameboyadvance.go doesn't exist

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0x942f26]

goroutine 1 [running]:
golang.org/x/tools/internal/lsp/cmd.(*connection).AddFile(0xc000004d80, 0xb8c600, 0xc0000760b8, 0xc00019fec0, 0x58, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/lsp/cmd/cmd.go:342 +0x156
golang.org/x/tools/internal/lsp/cmd.(*check).Run(0xc000006258, 0xb8c600, 0xc0000760b8, 0xc0000a8040, 0x1, 0x4, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/lsp/cmd/check.go:51 +0x1ca
golang.org/x/tools/internal/tool.Main.func2(0x0, 0xb8f2c0, 0xc000006258, 0xb8c600, 0xc0000760b8, 0xc000059aa0, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/tool/tool.go:130 +0xbe
golang.org/x/tools/internal/tool.Main(0xb8c600, 0xc0000760b8, 0xb8f2c0, 0xc000006258, 0xc0000a8040, 0x1, 0x4)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/tool/tool.go:131 +0x24a
golang.org/x/tools/internal/lsp/cmd.(*Application).Run(0xc0001fe000, 0xb8c600, 0xc0000760b8, 0xc0000a8040, 0x2, 0x4, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/lsp/cmd/cmd.go:112 +0x3f6
golang.org/x/tools/internal/tool.Main.func2(0xc0001fe000, 0xb8f200, 0xc0001fe000, 0xb8c600, 0xc0000760b8, 0xc000059a40, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/tool/tool.go:130 +0xbe
golang.org/x/tools/internal/tool.Main(0xb8c600, 0xc0000760b8, 0xb8f200, 0xc0001fe000, 0xc0000a8010, 0x4, 0x7)
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools@v0.0.0-20190710153321-831012c29e42/internal/tool/tool.go:131 +0x24a
main.main()
        C:/Users/kyle/dev/go/pkg/mod/golang.org/x/tools/gopls@v0.1.3/main.go:20 +0xc2
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Aug 3, 2019
@odeke-em odeke-em changed the title gopls: cmd.(*connection).AddFile crashes when given a nonexistent file x/tools/gopls: cmd.(*connection).AddFile crashes when given a nonexistent file Aug 3, 2019
@gopherbot gopherbot added this to the Unreleased milestone Aug 3, 2019
@gopherbot
Copy link

Change https://golang.org/cl/188857 mentions this issue: gopls: return file error if file open fails

@golang golang locked and limited conversation to collaborators Aug 4, 2020
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.
Projects
None yet
Development

No branches or pull requests

2 participants