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: invalid memory address or nil pointer dereference #46096

Closed
brownxoat opened this issue May 11, 2021 · 2 comments
Closed

x/tools/gopls: invalid memory address or nil pointer dereference #46096

brownxoat opened this issue May 11, 2021 · 2 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.
Milestone

Comments

@brownxoat
Copy link

brownxoat commented May 11, 2021

Main issue:
I get the following error in Emacs editing go code:

LSP :: Error from the Language Server: analysis printf for package github.com/brownxoat/test/v2 panicked: runtime error: invalid memory address or nil pointer dereference (Unknown error) [2 times]

Basically, adding any code will trigger a little squiggly underline (such as for errors with flycheck) on a random character of each newly added line of code, and it triggers a random error (such as `expected ';', found '...') which is weird since I thought go doesn't even use semicolons...

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

$ go version
go16.6.4

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/brownxoat/.cache/go-build"
GOENV="/home/brownxoat/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/brownxoat/src/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/brownxoat/src/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/brownxoat/.asdf/installs/golang/1.16.4/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/brownxoat/.asdf/installs/golang/1.16.4/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build546937608=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Given the following program:

package main

import "fmt"

func main() {
	fmt.Println("hello world")
}

add

fmt.Println("goodbye")

behind the initial fmt.Println statement.

What did you expect to see?

Everything to look find.

What did you see instead?

I get an error in Emacs (using gopls@latest and gocode) that is this in my message buffer in emacs:

LSP :: Error from the Language Server: analysis printf for package github.com/brownxoat/test/v2 panicked: runtime error: invalid memory address or nil pointer dereference (Unknown error) [5 times]

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label May 11, 2021
@stamblerre stamblerre added this to the Unreleased milestone May 11, 2021
@stamblerre stamblerre changed the title 2021-05-10 gopls runtime error; invalid memory address or nil pointer dereference x/tools/gopls: invalid memory address or nil pointer dereference May 11, 2021
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 11, 2021
@stamblerre
Copy link
Contributor

This sounds like a bug in your Emacs client. The error message that you are seeing is actually an error log that gopls logs for its own internal purposes, but it shouldn't be visible to the user. Please open an issue with your Emacs client.

each newly added line of code, and it triggers a random error (such as `expected ';', found '...') which is weird since I thought go doesn't even use semicolons...

In this case, you can imagine the ; to mean the end of the line, the Go parser inserts semicolons even if Go doesn't use them.

@apmattil
Copy link

apmattil commented Sep 30, 2021

here is log of dap-mode from emacs, what should lsp-client do other than show the message to user/UI ?

[Trace - 02:52:40 PM] Received notification 'window/logMessage'.
Params: {
  "message": "2021/09/30 14:52:40 warning: analyzing package: analysis testinggoroutine for package XXX panicked: runtime error: invalid memory address or nil pointer dereference\n\tsnapshot=1\n\tpackage=\"XXX/yyy [XXX/yyy.test]\"\n",
  "type": 1
}

@golang golang locked and limited conversation to collaborators Sep 30, 2022
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.
Projects
None yet
Development

No branches or pull requests

4 participants