ycm-core/YouCompleteMe

Update gopls installed by the go-completer

dhharris opened this issue · 1 comments

Issue Prelude

I'm getting the following error when opening a go file that uses the new module versioning

go.mod:3: invalid go version '1.21.3': must match format 1.23

This seems to be causing a lot of trouble with various software projects - after some discussions on the Gitter, I believe we need to update the verison of gopls to be compatible with these new versioning formats.

Workaround

Update gopls version using the cli

go install golang.org/x/tools/gopls@latest

Modify .vimrc to point to the new version

let g:ycm_gopls_binary_path = expand('$GOPATH/bin/gopls')

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I
    expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Include steps to reproduce here.

  1. vim -Nu ~/.bundle/YouCompleteMe/vimrc_ycm_minimal
  2. :e test.go
  3. Observe error loading packages

Include description of a minimal test case, including any actual code required
to reproduce the issue.

Set up a new go module with some dependencies as a pre-requisite for reproducing the issue

$ mkdir ycm_test && cd ycm_test
$ cat >test.go << EOF
> package test
>
> import (
>     "github.com/stretchr/testify/require"
> )
> EOF

$ go mod init ycm_test
go: creating new go.mod: module ycm_test
go: to add module requirements and sums:
        go mod tidy
$ go get -u
go: added github.com/davecgh/go-spew v1.1.1
go: added github.com/pmezard/go-difflib v1.0.0
go: added github.com/stretchr/testify v1.8.4
go: added gopkg.in/yaml.v3 v3.0.1
$ cat go.mod
module ycm_test

go 1.21.3

require github.com/stretchr/testify v1.8.4

require (
        github.com/davecgh/go-spew v1.1.1 // indirect
        github.com/pmezard/go-difflib v1.0.0 // indirect
        gopkg.in/yaml.v3 v3.0.1 // indirect
)
  • What did you expect to happen?

I expected the packages to load and go completion to work correctly

  • What actually happened?

Received an error due to malformed go version in go.mod

Diagnostic data

Output of vim --version

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Oct 07 2023 20:03:18)
macOS version - arm64
Included patches: 1-2000
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             +sound             -xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/opt/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: clang -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=14.0 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -lruby.3.2 -L/opt/homebrew/Cellar/ruby/3.2.2_1/lib 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /var/folders/tm/dpc775t148v9n9cjlvr3vby80000gn/T/ycm_tu5abj6r.log
-- Server Python interpreter: /opt/homebrew/opt/python@3.11/bin/python3.11
-- Server Python version: 3.11.6
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- Go completer debug information:
--   gopls running
--   gopls process ID: 35423
--   gopls executable: ['/Users/dhh/.bundle/YouCompleteMe/third_party/ycmd/third_party/go/bin/gopls', '-logfile', '/var/folders/tm/dpc775t148v9n9cjlvr3vby80000gn/T/gopls_stderr6p3y7lbu.log', '-rpc.trace']
--   gopls logfiles:
--     /var/folders/tm/dpc775t148v9n9cjlvr3vby80000gn/T/gopls_stderr6p3y7lbu.log
--   gopls Server State: Initialized
--   gopls Project Directory: /Users/dhh/ycm_test
--   gopls Settings: {
--   "hints": {
--     "assignVariableTypes": true,
--     "compositeLiteralFields": true,
--     "compositeLiteralTypes": true,
--     "constantValues": true,
--     "functionTypeParameters": true,
--     "parameterNames": true,
--     "rangeVariableTypes": true
--   },
--   "hoverKind": "Structured",
--   "semanticTokens": true
-- }
-- Server running at: http://127.0.0.1:61297
-- Server process ID: 35422
-- Server logfiles:
--   /var/folders/tm/dpc775t148v9n9cjlvr3vby80000gn/T/ycmd_61297_stdout_f5jq3757.log
--   /var/folders/tm/dpc775t148v9n9cjlvr3vby80000gn/T/ycmd_61297_stderr_brp9qglu.log
-- Semantic highlighting supported: True
-- Virtual text supported: True
-- Popup windows supported: True

Output of YcmDiags

No warnings or errors detected.

Output of git rev-parse HEAD in YouCompleteMe installation directory

$ git -C ~/.bundle/YouCompleteMe rev-parse HEAD
cc9a3ae3efdcc7d038aab0620ea28882533c236c

Contents of YCM, ycmd and completion engine logfiles

Reproduce the issue with vim -Nu /path/to/YCM/vimrc_ycm_minimal, which
enabled debug logging and other useful diagnostics. Include a link to a
gist containing all of the log files listed by :YcmToggleLogs.

https://gist.github.com/dhharris/3df11077da7771a80b67d62ae6f7a823

OS version, distribution, etc.

Software:

    System Software Overview:

      System Version: macOS 14.0 (23A344)
      Kernel Version: Darwin 23.0.0