go: x/tools/gopls: nil pointer in analysis

Please answer these questions before submitting your issue. Thanks!

What did you do?

I had gopls running

What did you expect to see?

gopls doing stuff

What did you see instead?

gopls doing stuff and restarting

stack trace of

[Error - 10:36:37.252 AM] Received #2 ToUTF16Column: column is invalid (-1)


panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1693475]

goroutine 92 [running]:
golang.org/x/tools/internal/lsp/cache.(*actionHandle).analyze(0xc0025b3360, 0x19b0e20, 0xc000270a80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:149 +0x65
golang.org/x/tools/internal/lsp/cache.(*snapshot).Analyze(0xc0000de820, 0x19b0e20, 0xc000270a80, 0xc0002c47c0, 0x32, 0xc000d83000, 0x88, 0x100, 0x0, 0x101, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:39 +0x25e
golang.org/x/tools/internal/lsp/source.analyses(0x19b0e20, 0xc000270a80, 0x19b3fe0, 0xc0000de820, 0x19b3fa0, 0xc000383b30, 0x0, 0xc0025bb650, 0x1, 0x1)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:169 +0x294
golang.org/x/tools/internal/lsp/source.Diagnostics(0x19b0e20, 0xc000270a80, 0x19c1540, 0xc00032e900, 0x239a240, 0xc000218340, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:87 +0x971
golang.org/x/tools/internal/lsp.(*Server).diagnostics(0xc00029cf00, 0x19c1540, 0xc00032e900, 0xc0002f22d0, 0x4b, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/diagnostics.go:30 +0x2e0
created by golang.org/x/tools/internal/lsp.(*Server).didChange
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/text_synchronization.go:82 +0x373
[Trace - 10:36:50.040 AM] Sending request 'initialize - (1)'.
Params: {"processId":0,"rootUri":"file:///","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{},"didChangeConfiguration":{},"didChangeWatchedFiles":{},"symbol":{},"executeCommand":{},"workspaceFolders":true},"textDocument":{"synchronization":{},"completion":{},"hover":{},"signatureHelp":{},"declaration":{},"definition":{},"typeDefinition":{},"implementation":{},"references":{},"documentHighlight":{},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["source.organizeImports"]}}},"formatting":{},"rangeFormatting":{},"onTypeFormatting":{},"codeLens":{},"documentLink":{},"rename":{},"publishDiagnostics":{},"colorProvider":{},"foldingRange":{},"selectionRange":{}}},"initializationOptions":{"hoverKind":"FullDocumentation","staticcheck":true},"workspaceFolders":[{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/bx-pipe","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/bx-pipe"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl","name":"/Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl"}]}

another example

[Trace - 10:36:34.203 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/04 10:36:34 go/packages.Load\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tfiles = [/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/bx.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/compilerflags.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/fieldtype_string.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/interpreter.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/parser.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/symbols.go]"}


[Trace - 10:36:34.304 AM] Received response 'textDocument/completion - (2)' in 299ms.
Result: {"isIncomplete":false,"items":[]}


panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1693475]

goroutine 31 [running]:
golang.org/x/tools/internal/lsp/cache.(*actionHandle).analyze(0xc002542d20, 0x19b0e20, 0xc000282a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:149 +0x65
golang.org/x/tools/internal/lsp/cache.(*snapshot).Analyze(0xc00025c190, 0x19b0e20, 0xc000282a20, 0xc0001d4f00, 0x32, 0xc001ced800, 0x88, 0x100, 0x0, 0x101, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:39 +0x25e
golang.org/x/tools/internal/lsp/source.analyses(0x19b0e20, 0xc000282a20, 0x19b3fe0, 0xc00025c190, 0x19b3fa0, 0xc00024d0e0, 0x0, 0xc0023810b0, 0x1, 0x1)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:169 +0x294
golang.org/x/tools/internal/lsp/source.Diagnostics(0x19b0e20, 0xc000282a20, 0x19c1540, 0xc000001980, 0x5400008, 0xc00018c580, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:87 +0x971
golang.org/x/tools/internal/lsp.(*Server).diagnostics(0xc000169ce0, 0x19c1540, 0xc000001980, 0xc00003c1e0, 0x4b, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/diagnostics.go:30 +0x2e0
created by golang.org/x/tools/internal/lsp.(*Server).didChange
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/text_synchronization.go:82 +0x373
[Trace - 10:36:35.026 AM] Sending request 'initialize - (1)'

Build info

golang.org/x/tools/gopls v0.1.6
    golang.org/x/tools/gopls@(devel)
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191017151554-a3bc800455d5 => ../
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=

Go info

go version go1.13.3 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ilanpillemer/Library/Caches/go-build"
GOENV="/Users/ilanpillemer/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="bitbucket.org/bxbdigital"
GONOSUMDB="bitbucket.org/bxbdigital"
GOOS="darwin"
GOPATH="/Users/ilanpillemer/go"
GOPRIVATE="bitbucket.org/bxbdigital"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/z4/rs3f6lcs10l9rhf6wg4vdjt80000gn/T/go-build158073267=/tmp/go-build -gno-record-gcc-switches -fno-common"

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 35 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks! Just pushed another update to the CL 😃 The change that actually fixes the nil pointer has been merged and cherry-picked for the release, so thank you for helping me find that! The remaining investigation will help us understand why there is an error creating an error message here.

Oh I’m sorry, I should’ve been more precise with my language. I didn’t mean latest as in the latest tag, but rather latest as in master. Edited my comment.