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

kylelemons opened this issue Aug 3, 2019 · 1 comment


Copy link

@kylelemons kylelemons commented Aug 3, 2019

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 GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set GOARM=7
set CC=gcc
set CXX=g++
set GOMOD=C:\Users\kyle\dev\tinygo_gba\tinygo\go.mod
set CGO_CFLAGS=-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
---------- v0.1.2 h1:CB5ECiPysqZrwxcyRjN+exyZpY0gODTZvNiqQi3lpeo= h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= 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]:*connection).AddFile(0xc000004d80, 0xb8c600, 0xc0000760b8, 0xc00019fec0, 0x58, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/ +0x156*check).Run(0xc000006258, 0xb8c600, 0xc0000760b8, 0xc0000a8040, 0x1, 0x4, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/ +0x1ca, 0xb8f2c0, 0xc000006258, 0xb8c600, 0xc0000760b8, 0xc000059aa0, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/ +0xbe, 0xc0000760b8, 0xb8f2c0, 0xc000006258, 0xc0000a8040, 0x1, 0x4)
        C:/Users/kyle/dev/go/pkg/mod/ +0x24a*Application).Run(0xc0001fe000, 0xb8c600, 0xc0000760b8, 0xc0000a8040, 0x2, 0x4, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/ +0x3f6, 0xb8f200, 0xc0001fe000, 0xb8c600, 0xc0000760b8, 0xc000059a40, 0x0, 0x0)
        C:/Users/kyle/dev/go/pkg/mod/ +0xbe, 0xc0000760b8, 0xb8f200, 0xc0001fe000, 0xc0000a8010, 0x4, 0x7)
        C:/Users/kyle/dev/go/pkg/mod/ +0x24a
        C:/Users/kyle/dev/go/pkg/mod/ +0xc2
@gopherbot gopherbot added the 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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 3, 2019

Change mentions this issue: gopls: return file error if file open fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.