Random panics when autocompleting
elisaado opened this issue · comments
Eli Saado commented
What version of Go are you using (go version
)?
go version go1.11.2 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/eli/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/eli/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build448761106=/tmp/go-build -gno-record-gcc-switches"
What is the debug output of gocode
?
eli@probook ~ % gocode -s -debug
2018/11/24 21:17:39 Got autocompletion request for '/home/eli/helloWorld.go'
2018/11/24 21:17:39 Cursor at: 56
2018/11/24 21:17:39 -------------------------------------------------------
package main
import "fmt"
func main() {
fmt.Println#
}
2018/11/24 21:17:39 -------------------------------------------------------
panic: runtime error: invalid memory address or nil pointer dereference
goroutine 37 [running]:
runtime/debug.Stack(0xb, 0xc0001cd160, 0x1)
/usr/lib/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
/usr/lib/go/src/runtime/debug/stack.go:16 +0x22
main.(*Server).AutoComplete.func1(0xc000150940)
/home/eli/go/src/github.com/mdempsky/gocode/server.go:79 +0x94
panic(0x871ba0, 0xc82cb0)
/usr/lib/go/src/runtime/panic.go:513 +0x1b9
github.com/mdempsky/gocode/internal/suggest.pkgNameFor(0xc00020a7a0, 0x11, 0x2, 0xc00020a7a0)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:311 +0x6d
github.com/mdempsky/gocode/internal/suggest.(*Config).findOtherPackageFiles(0xc0001509c0, 0xc00017c420, 0x17, 0xc000156518, 0x4, 0x20, 0xc00017a380, 0x0)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:292 +0x340
github.com/mdempsky/gocode/internal/suggest.(*Config).analyzePackage(0xc0001509c0, 0xc00017c420, 0x17, 0xc0001be080, 0x3b, 0x3b, 0x38, 0x0, 0x0, 0x0, ...)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:170 +0x465
github.com/mdempsky/gocode/internal/suggest.(*Config).Suggest(0xc0001509c0, 0xc00017c420, 0x17, 0xc0001be080, 0x3b, 0x3b, 0x38, 0xc000183310, 0x84d22515bf4a2f25, 0x894e80, ...)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:50 +0xb5
main.(*Server).AutoComplete(0xc000156188, 0xc0001809c0, 0xc000150940, 0x0, 0x0)
/home/eli/go/src/github.com/mdempsky/gocode/server.go:128 +0x4c5
reflect.Value.call(0xc00014c360, 0xc000154068, 0x13, 0x8f1fb4, 0x4, 0xc000053f18, 0x3, 0x3, 0xc00014a000, 0x0, ...)
/usr/lib/go/src/reflect/value.go:447 +0x449
reflect.Value.Call(0xc00014c360, 0xc000154068, 0x13, 0xc0001b7718, 0x3, 0x3, 0x0, 0x0, 0x0)
/usr/lib/go/src/reflect/value.go:308 +0xa4
net/rpc.(*service).call(0xc00014a580, 0xc000182000, 0xc000022128, 0xc000022140, 0xc00017a280, 0xc00000c060, 0x8343a0, 0xc0001809c0, 0x16, 0x834360, ...)
/usr/lib/go/src/net/rpc/server.go:384 +0x14e
created by net/rpc.(*Server).ServeCodec
/usr/lib/go/src/net/rpc/server.go:481 +0x47e
2018/11/24 21:17:40 Got autocompletion request for '/home/eli/helloWorld.go'
2018/11/24 21:17:40 Cursor at: 56
2018/11/24 21:17:40 -------------------------------------------------------
package main
import "fmt"
func main() {
fmt.Println#()
}
2018/11/24 21:17:40 -------------------------------------------------------
2018/11/24 21:17:40 Error parsing input file (outer block):
2018/11/24 21:17:40 /home/eli/helloWorld.go:6:16: expected operand, found ')'
2018/11/24 21:17:40 /home/eli/helloWorld.go:7:3: expected ')', found 'EOF'
2018/11/24 21:17:40 /home/eli/helloWorld.go:7:3: expected ';', found 'EOF'
2018/11/24 21:17:40 /home/eli/helloWorld.go:7:3: expected ';', found 'EOF'
2018/11/24 21:17:40 /home/eli/helloWorld.go:7:3: expected '}', found 'EOF'
panic: runtime error: invalid memory address or nil pointer dereference
goroutine 4 [running]:
runtime/debug.Stack(0xb, 0xc00022d160, 0x1)
/usr/lib/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
/usr/lib/go/src/runtime/debug/stack.go:16 +0x22
main.(*Server).AutoComplete.func1(0xc00000c740)
/home/eli/go/src/github.com/mdempsky/gocode/server.go:79 +0x94
panic(0x871ba0, 0xc82cb0)
/usr/lib/go/src/runtime/panic.go:513 +0x1b9
github.com/mdempsky/gocode/internal/suggest.pkgNameFor(0xc000270ca0, 0x11, 0x2, 0xc000270ca0)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:311 +0x6d
github.com/mdempsky/gocode/internal/suggest.(*Config).findOtherPackageFiles(0xc00000c780, 0xc0000286a0, 0x17, 0xc000022428, 0x4, 0x20, 0xc0001c4080, 0x9760a0)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:292 +0x340
github.com/mdempsky/gocode/internal/suggest.(*Config).analyzePackage(0xc00000c780, 0xc0000286a0, 0x17, 0xc00002a080, 0x3d, 0x3d, 0x38, 0x0, 0x0, 0x0, ...)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:170 +0x465
github.com/mdempsky/gocode/internal/suggest.(*Config).Suggest(0xc00000c780, 0xc0000286a0, 0x17, 0xc00002a080, 0x3d, 0x3d, 0x38, 0xc00023c0a0, 0xc000053860, 0x4145e5, ...)
/home/eli/go/src/github.com/mdempsky/gocode/internal/suggest/suggest.go:50 +0xb5
main.(*Server).AutoComplete(0xc000156188, 0xc0002220d0, 0xc00000c740, 0x0, 0x0)
/home/eli/go/src/github.com/mdempsky/gocode/server.go:128 +0x4c5
reflect.Value.call(0xc00014c360, 0xc000154068, 0x13, 0x8f1fb4, 0x4, 0xc000053f18, 0x3, 0x3, 0xc000068180, 0x848860, ...)
/usr/lib/go/src/reflect/value.go:447 +0x449
reflect.Value.Call(0xc00014c360, 0xc000154068, 0x13, 0xc00003ef18, 0x3, 0x3, 0x8c04c0, 0x8d0d01, 0xc000068080)
/usr/lib/go/src/reflect/value.go:308 +0xa4
net/rpc.(*service).call(0xc00014a580, 0xc000182000, 0xc0001577a0, 0xc0001577b0, 0xc00017a280, 0xc00000c060, 0x8343a0, 0xc0002220d0, 0x16, 0x834360, ...)
/usr/lib/go/src/net/rpc/server.go:384 +0x14e
created by net/rpc.(*Server).ServeCodec
/usr/lib/go/src/net/rpc/server.go:481 +0x47e
What (client-side) flags are you passing into gocode
?
I am unsure.
What editor are using?
Atom with go-plus.
Notes
- this does not happen with nsf/gocode
Rebecca Stambler commented
dc34cac should stop the panics from happening.