Vim-go: new error appearing after gopls initialized

Created on 28 Feb 2020  路  12Comments  路  Source: fatih/vim-go

apologies for not filling out the template. i accidentally pasted over it, and now, even after clicking back and "new issue" again, logging out of github, doing a hard page reload, whenever i click on "new issue" it brings me back to the state it was in last time i edited it..

anyways, i am seeing the following error whenever editing .go files for maybe 2 days now:

Screen Shot 2020-02-28 at 01 20 47

it seems related to this commit:
https://github.com/fatih/vim-go/commit/af0a13f19476e421650c4ed03b240856ed9a7e13

that was the only instance of l:version i think i could find in the source code. thank you for taking the time to look into it

Most helpful comment

@sdejean you can run :GoUpdateBinaries gopls to update gopls in vim-go without having to restart Vim.

All 12 comments

would just changing line 276 of vim-go/autoload/go/lsp.vim to:

          if l:version != 0 && get(l:data, 'version', 0) == l:version

be appropriate fix?

What version of gopls are you using?

gopls version:
version 0.2.2, build in $GOPATH mode

@frescoraja I had the same error, upgrading to gopls version 0.3.2 seemed to fix it for me

thank you i will try this, but i think this issue should probably be still fixed

i get the following error when trying to upgrade to 0.3.2:

golang.org/x/tools/internal/lsp/source
# golang.org/x/tools/internal/lsp/source
../../.gvm/pkgsets/go1.11.6/global/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/completion.go:637:21: file.LineStart undefined (type *token.File has no field or method LineStart)
../../.gvm/pkgsets/go1.11.6/global/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/format.go:251:27: fset.File(f.Pos()).LineStart undefined (type *token.File has no field or method LineStart)
../../.gvm/pkgsets/go1.11.6/global/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/format.go:276:13: tok.LineStart undefined (type *token.File has no field or method LineStart)

馃 I certainly didn't get that error, I only had to do:
GO111MODULE=on go get golang.org/x/tools/gopls@latest and restart my editor (neovim) for it to work.

I should also note I'm on Go 1.14 (I probably should have noted that first)

yeah , after doing some research it looks like latest versions of gopls are not compatible with go versions < 1.12 :(

@frescoraj vim-go generally doesn't support Go versions indefinitely. The problem you're encountering is because gopls v0.2.2 didn't provide file versions, but gopls v0.3.2 does.

You have a couple of options:

  1. update Go and then run :GoUpdateBinaries gopls
  2. stick with a version of vim-go and gopls that works well with Go 1.11.

@sdejean you can run :GoUpdateBinaries gopls to update gopls in vim-go without having to restart Vim.

@sdejean you can run :GoUpdateBinaries gopls to update gopls in vim-go without having to restart Vim.

vim-go: function 273[10]..276[3]..277[2]..278, line 52: Vim(if):E716: Key not present in Dictionary: version == l:version

Tks , :GoUpdateBinaries gopls Can solve this problem .

:GoUpdateBinaries gopls is not work for me, then I run :PluginUpdate solve this problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SirmaXX picture SirmaXX  路  3Comments

jongillham picture jongillham  路  3Comments

smontazeran picture smontazeran  路  4Comments

orlangure picture orlangure  路  3Comments

johnzeng picture johnzeng  路  3Comments