fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.98k stars 1.45k forks source link

nvim snap error on opening file #3580

Closed Aflynn50 closed 1 year ago

Aflynn50 commented 1 year ago

What did you do? (required: The issue will be closed when not provided)

Open a non-empty go file in nvim. This error occurs every time I open a file. It started happening after I installed (and then removed) the plugins nvim-treesitter, nvim-lspconfig and ray-x/go.nvim. The error occurs even with the plugins removed from the system.

What did you expect to happen?

I expected it to open the file without crashing.

What happened instead?

I got this error

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:21: Error executing lua: /snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:22: BufReadPost Autocommands fo
r "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[21]..script /home/aflynn/.local/share/nvim/plugged/vim-go/ftplugin/go/commands.vim[108]..function go#package#InGOPATH, line
 15: Vim(let):E684: list index out of range: 0
stack traceback:
        [C]: in function 'nvim_cmd'
        /snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:22: in function </snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:21>
        [C]: in function 'nvim_buf_call'
        /snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:21: in function </snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:21: in function </snap/nvim/2809/usr/share/nvim/runtime/filetype.lua:10>

Configuration (MUST fill this out):

vim-go version:

vimrc you used to reproduce:

vimrc ```vim call plug#begin() Plug 'fatih/vim-go' call plug#end() ```

Vim version (first three lines from :version):

Installed as a snap

NVIM v0.9.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Go version (go version):

go1.18.10 linux/amd64

Go environment

go env Output:

```
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/aflynn/.cache/go-build"
GOENV="/home/aflynn/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/aflynn/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/aflynn/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/10029"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/10029/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.10"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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-build4233797071=/tmp/go-build -gno-record-gcc-switches"
```

gopls version

gopls version Output:

```
golang.org/x/tools/gopls v0.13.2
```
bhcleek commented 1 year ago

I'm not sure what's going on here, but it something to do with the output of go list. It may be related to using snap. I've seen others have problems with snap for some reason. What does :!go list output when run from within vim after you get the error you documented above?

Aflynn50 commented 1 year ago

That seems to be it, the go list command returns nothing when I do :! go list. It works fine when I do it from the command line.

Looks like the error is actually know about for the snap: https://github.com/neovim/neovim-snap/issues/25.

I've installed it with the AppImage for now. Thanks!