fatih / vim-go

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

Error detected while processing function go#package#InGOPATH #3349

Closed jm33-m0 closed 2 years ago

jm33-m0 commented 2 years ago

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

Open a Go file with code in it

What did you expect to happen?

There shouldn't be errors in :messages

What happened instead?

On loading, I see commands.vim throws exceptions:

Error detected while processing function go#package#InGOPATH:                                                                                                                                                               
line   15:                                                                                                                                                                                                                  
E684: list index out of range: 0                                                                                                                                                                                            
Error detected while processing /home/u/.dein/repos/github.com/fatih/vim-go/ftplugin/go/commands.vim:                                                                                                                       
line  106:                                                                                                                                                                                                                  
E171: Missing :endif           

Configuration (MUST fill this out):

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ==>> vim-go
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:go_metalinter_command = 'golangci-lint'
let g:go_rename_command = 'gopls'
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_fmt_command = 'gopls'
let g:go_doc_keywordprg_enabled = 0
let g:go_gocode_autobuild = 1
let g:go_gocode_unimported_packages = 1
let g:go_go_code_completion_enabled = 0
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_format_strings = 1
let g:go_highlight_methods = 1
set autowrite
" popup window for GoDoc
let g:go_doc_popup_window = 1

vim-go version:

vimrc you used to reproduce:

vimrc ```vim "dein Scripts----------------------------- if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath+=~/.dein/repos/github.com/Shougo/dein.vim " Required: call dein#begin('~/.dein') " Let dein manage dein " Required: call dein#add('~/.dein/repos/github.com/Shougo/dein.vim') " dein call dein#add('wsdjeg/dein-ui.vim') call dein#add('haya14busa/dein-command.vim') " Autocomplete call dein#add('Shougo/deoplete.nvim') if !has('nvim') call dein#add('roxma/nvim-yarp') call dein#add('roxma/vim-hug-neovim-rpc') endif let g:deoplete#enable_at_startup = 1 call dein#add('Shougo/neosnippet.vim') call dein#add('Shougo/neosnippet-snippets') call dein#add('ncm2/float-preview.nvim') " preview in floating window " " tabnine " if has('win32') || has('win64') " call dein#add('tbodt/deoplete-tabnine', { 'build': 'powershell.exe .\install.ps1' }) " else " call dein#add('tbodt/deoplete-tabnine', { 'build': './install.sh' }) " endif " Golang call dein#add('fatih/vim-go', {'on_ft': 'go'}) " Required: call dein#end() " Required: filetype plugin indent on syntax enable " " If you want to install not installed plugins on startup. if dein#check_install() call dein#install() endif "End dein Scripts------------------------- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ==>> vim-go """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:go_metalinter_command = 'golangci-lint' let g:go_rename_command = 'gopls' let g:go_def_mode='gopls' let g:go_info_mode='gopls' let g:go_fmt_command = 'gopls' let g:go_doc_keywordprg_enabled = 0 let g:go_gocode_autobuild = 1 let g:go_gocode_unimported_packages = 1 let g:go_go_code_completion_enabled = 0 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_build_constraints = 1 let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_parameters = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_format_strings = 1 let g:go_highlight_methods = 1 set autowrite " popup window for GoDoc let g:go_doc_popup_window = 1 ```

Vim version (first three lines from :version):

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

Go version (go version):

go version go1.17.6 linux/amd64

Go environment

go env Output:

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

gopls version

gopls version Output:

golang.org/x/tools/gopls v0.7.5
    golang.org/x/tools/gopls@v0.7.5 h1:8Az52YwcFXTWPvrRomns1C0N+zlgTyyPKWvRazO9GG8=
bhcleek commented 2 years ago

Do you see this always or only sometime? Others have reported this, but I've been unable to find a way to duplicate it.

jm33-m0 commented 2 years ago

I can reproduce this on a Ubuntu VM (go installed via snap) reliably, but on other machines it's fine.

If I comment out this command, the error will disappear. It's weird that I was unable to invoke GoKeyify even when working in GOPATH https://github.com/fatih/vim-go/blob/8dfedede1c6e27e4339411b1071fee6a40663f11/ftplugin/go/commands.vim#L106

bhcleek commented 2 years ago

If you can duplicate this reliably, then we may be able to get to the bottom of it.

Can you open a shell in the directory that contains the file that you have open when you see this and provide the output of go list with GO111MODULE set to off?

jm33-m0 commented 2 years ago

Here's a screenshot, with provided init.vim

image

bhcleek commented 2 years ago

Can you try this with https://github.com/fatih/vim-go/pull/3352 and let me know what message it gives you?

jm33-m0 commented 2 years ago

I replaced package.vim with the one you modified, there was no error message

vim-go: initialized gopls                                                                                            
vim-go: Finished loading packages.
Press ENTER or type command to continue
bhcleek commented 2 years ago

That's odd. The only difference is that I wrapped the offending line in a try/catch and output the go list result when an exception was thrown 🤔

jm33-m0 commented 2 years ago

Maybe it caught something but didn't print the message?

bhcleek commented 2 years ago

I don't see how that would be possible in this instance

bhcleek commented 2 years ago

Are you still experiencing this issue or should we close this issue?

jm33-m0 commented 2 years ago

On that Ubuntu VM, yes.

bhcleek commented 2 years ago

Ok, then if we're going to get to the bottom of this, then we'll need that output on the Ubuntu VM from the branch I referenced earlier. If it can't reproduce on that branch, then I suspect something else is amiss and will need the package.vim file from that Ubuntu VM when your error message does reproduce.

jm33-m0 commented 2 years ago

Here it is, no modifications made, throws error reliably

package.vim ```vim " Copyright 2011 The Go Authors. All rights reserved. " Use of this source code is governed by a BSD-style " license that can be found in the LICENSE file. " " This file provides a utility function that performs auto-completion of " package names, for use by other commands. " don't spam the user when Vim is started in Vi compatibility mode let s:cpo_save = &cpo set cpo&vim let s:goos = $GOOS let s:goarch = $GOARCH if len(s:goos) == 0 if exists('g:golang_goos') let s:goos = g:golang_goos elseif has('win32') || has('win64') let s:goos = 'windows' elseif has('macunix') let s:goos = 'darwin' else let s:goos = '*' endif endif if len(s:goarch) == 0 if exists('g:golang_goarch') let s:goarch = g:golang_goarch else let s:goarch = '*' endif endif function! s:paths() abort let dirs = [] if !exists("s:goroot") if executable('go') let s:goroot = go#util#env("goroot") if go#util#ShellError() != 0 call go#util#EchoError('`go env GOROOT` failed') endif else let s:goroot = $GOROOT endif endif if len(s:goroot) != 0 && isdirectory(s:goroot) let dirs += [s:goroot] endif let workspaces = split(go#path#Default(), go#util#PathListSep()) if workspaces != [] let dirs += workspaces endif return dirs endfunction function! s:module() abort let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Dir}}']) if l:err != 0 return {} endif let l:dir = split(l:out, '\n')[0] let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Path}}']) if l:err != 0 return {} endif let l:path = split(l:out, '\n')[0] return {'dir': l:dir, 'path': l:path} endfunction function! s:vendordirs() abort let l:vendorsuffix = go#util#PathSep() . 'vendor' let l:module = s:module() if empty(l:module) let [l:root, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Root}}']) if l:err != 0 return [] endif if empty(l:root) return [] endif let l:root = split(l:root, '\n')[0] . go#util#PathSep() . 'src' let [l:dir, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Dir}}']) if l:err != 0 return [] endif let l:dir = split(l:dir, '\n')[0] let l:vendordirs = [] while l:dir != l:root let l:vendordir = l:dir . l:vendorsuffix if isdirectory(l:vendordir) let l:vendordirs = add(l:vendordirs, l:vendordir) endif let l:dir = fnamemodify(l:dir, ':h') endwhile return l:vendordirs endif let l:vendordir = l:module.dir . l:vendorsuffix if !isdirectory(l:vendordir) return [] endif return [l:vendordir] endfunction let s:import_paths = {} " ImportPath returns the import path of the package for current buffer. It " returns -1 if the import path cannot be determined. function! go#package#ImportPath() abort let l:dir = expand("%:p:h") if has_key(s:import_paths, dir) return s:import_paths[l:dir] endif let l:importpath = go#package#FromPath(l:dir) if type(l:importpath) == type(0) return -1 endif let s:import_paths[l:dir] = l:importpath return l:importpath endfunction let s:in_gopath = {} " InGOPATH returns TRUE when the package of the current buffer is within " GOPATH. function! go#package#InGOPATH() abort let l:dir = expand("%:p:h") if has_key(s:in_gopath, dir) return s:in_gopath[l:dir][0] !=# '_' endif try " turn off module support so that `go list` will report the package name " with a leading '_' when the current buffer is not within GOPATH. let Restore_modules = go#util#SetEnv('GO111MODULE', 'off') let [l:out, l:err] = go#util#ExecInDir(['go', 'list']) if l:err != 0 return 0 endif let l:importpath = split(l:out, '\n')[0] if len(l:importpath) > 0 let s:in_gopath[l:dir] = l:importpath endif finally call call(Restore_modules, []) endtry return len(l:importpath) > 0 && l:importpath[0] !=# '_' endfunction " go#package#FromPath returns the import path of arg. -1 is returned when arg " does not specify a package. -2 is returned when arg is a relative path " outside of GOPATH, not in a module, and not below the current working " directory. A relative path is returned when in a null module at or below the " current working directory.. function! go#package#FromPath(arg) abort let l:path = fnamemodify(a:arg, ':p') if !isdirectory(l:path) let l:path = fnamemodify(l:path, ':h') endif let l:dir = go#util#Chdir(l:path) try if glob("*.go") == "" " There's no Go code in this directory. We might be in a module directory " which doesn't have any code at this level. To avoid `go list` making a " bunch of HTTP requests to fetch dependencies, short-circuit `go list` " and return -1 immediately. if !empty(s:module()) return -1 endif endif let [l:out, l:err] = go#util#Exec(['go', 'list']) if l:err != 0 return -1 endif let l:importpath = split(l:out, '\n')[0] finally call go#util#Chdir(l:dir) endtry " go list returns '_CURRENTDIRECTORY' if the directory is in a null module " (i.e. neither in GOPATH nor in a module). Return a relative import path " if possible or an error if that is the case. if l:importpath[0] ==# '_' let l:relativeimportpath = fnamemodify(l:importpath[1:], ':.') if go#util#IsWin() let l:relativeimportpath = substitute(l:relativeimportpath, '\\', '/', 'g') endif if l:relativeimportpath == l:importpath[1:] return '.' endif if l:relativeimportpath[0] == '/' return -2 endif let l:importpath= printf('./%s', l:relativeimportpath) endif return l:importpath endfunction function! go#package#CompleteMembers(package, member) abort let [l:content, l:err] = go#util#Exec(['go', 'doc', a:package]) if l:err || !len(content) return [] endif let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'") try let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*' let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*' let candidates = map(filter(copy(lines), 'v:val =~ mx1'), \ 'substitute(v:val, mx1, "\\1", "")') \ + map(filter(copy(lines), 'v:val =~ mx2'), \ 'substitute(v:val, mx2, "\\1", "")') return filter(candidates, '!stridx(v:val, a:member)') catch return [] endtry endfunction function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort let words = split(a:CmdLine, '\s\+', 1) " do not complete package members for these commands let neglect_commands = ["GoImportAs", "GoGuruScope"] if len(words) > 2 && index(neglect_commands, words[0]) == -1 " Complete package members return go#package#CompleteMembers(words[1], words[2]) endif let dirs = s:paths() let module = s:module() if len(dirs) == 0 && empty(module) " should not happen return [] endif let vendordirs = s:vendordirs() let l:modcache = go#util#env('gomodcache') let ret = {} for dir in dirs " this may expand to multiple lines let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") if l:modcache != '' let root = add(root, l:modcache) else let root = add(root, expand(dir . '/pkg/mod')) endif let root = add(root, expand(dir . '/src'), ) let root = extend(root, vendordirs) let root = add(root, module) for item in root " item may be a dictionary when operating in a module. if type(item) == type({}) if empty(item) continue endif let dir = item.dir let path = item.path else let dir = item let path = item endif if !empty(module) && dir ==# module.dir if stridx(a:ArgLead, module.path) == 0 if len(a:ArgLead) != len(module.path) let glob = globpath(module.dir, substitute(a:ArgLead, module.path . '/\?', '', '').'*') else let glob = module.dir endif elseif stridx(module.path, a:ArgLead) == 0 && stridx(module.path, '/', len(a:ArgLead)) < 0 " use the module directory when module.path begins wih a:ArgLead and " module.path does not have any path segments after a:ArgLead. let glob = module.dir else continue endif else let glob = globpath(dir, a:ArgLead.'*') endif for candidate in split(glob) if isdirectory(candidate) " TODO(bc): use wildignore instead of filtering out vendor " directories manually? if fnamemodify(candidate, ':t') == 'vendor' continue endif " if path contains version info, strip it out let vidx = strridx(candidate, '@') if vidx >= 0 let candidate = strpart(candidate, 0, vidx) endif let candidate .= '/' elseif candidate !~ '\.a$' continue endif if dir !=# path let candidate = substitute(candidate, '^' . dir, path, 'g') else let candidate = candidate[len(dir)+1:] endif " replace a backslash with a forward slash and drop .a suffixes let candidate = substitute(substitute(candidate, '[\\]', '/', 'g'), \ '\.a$', '', 'g') " without this the result can have duplicates in form of " 'encoding/json' and '/encoding/json/' let candidate = go#util#StripPathSep(candidate) let ret[candidate] = candidate endfor endfor endfor return sort(keys(ret)) endfunction " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save " vim: sw=2 ts=2 et ```
bhcleek commented 2 years ago

Given the error you're seeing:

Error detected while processing function go#package#InGOPATH:                                                                                                                                                               
line   15:                                                                                                                                                                                                                  
E684: list index out of range: 0                                                                                                                                                                                            
Error detected while processing /home/u/.dein/repos/github.com/fatih/vim-go/ftplugin/go/commands.vim:                                                                                                                       
line  106:                                                                                                                                                                                                                  
E171: Missing :endif           

line 15 in the file you provided is let l:importpath = split(l:out, '\n')[0].

But if that's the case, then the PR I linked earlier, https://github.com/fatih/vim-go/pull/3352, should output the go list output and exit code in the output of :messages after when you're normally seeing this error. If it's not, then can you put call go#util#EchoError(printf('go list in %s returned [%s, %d]', expand('%:p:h'), l:out, l:err)) on the line before let l:importpath = split(l:out, '\n')[0] in go#package#InGOPATH? In that case you should see in the output of :messages both the go list output and exit code and the error you've been seeing.

jm33-m0 commented 2 years ago

It gives me this: [, 0]

vim-go: initializing gopls                                                                                                     
vim-go: go list in /home/u/emp3r0r/core/lib/agent returned [, 0]                                                               
Error detected while processing function go#package#InGOPATH:                                                                  
line   16:                                                                                                                     
E684: list index out of range: 0                                                                                               
Error detected while processing /home/u/.dein/repos/github.com/fatih/vim-go/ftplugin/go/commands.vim:                          
line  106:                                                                                                                     
E171: Missing :endif   
bhcleek commented 2 years ago

That's odd. Can you put

    let [l:out, l:err] = go#util#ExecInDir(['env'])
    call go#util#EchoInfo(printf("env => \n%s", l:out))

between these two lines in go#package#InGOPATH:

    let Restore_modules = go#util#SetEnv('GO111MODULE', 'off')
    let [l:out, l:err] = go#util#ExecInDir(['go', 'list'])

and let me know the output?

jm33-m0 commented 2 years ago

It shows output from env, the same as manually executing env in that directory

I couldn't find a way to copy the output of :message as it's too long (it's a shame that vim/nvim doesn't even provide a way to redirect command output to a file)

If you are interested in specific environment variables, I can paste them here

bhcleek commented 2 years ago

I'd like to know what GO111MODULE is in that output.

jm33-m0 commented 2 years ago

It's off:

vim-go: GO111MODULE=off
jm33-m0 commented 2 years ago

Here's output of go env, seems GO111MODULE has a default value, instead of off

❯ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/u/.cache/go-build"
GOENV="/home/u/.config/go/env"
GOEXE=""
...

Okay, I just noticed this line sets GO111MODULE to off, I don't understand why it does that, though

let Restore_modules = go#util#SetEnv('GO111MODULE', 'off')
bhcleek commented 2 years ago

The comment above the line explains why: https://github.com/fatih/vim-go/blob/master/autoload/go/package.vim#L146-L147

bhcleek commented 2 years ago

I'm not sure if it has anything to do with this, but I noticed some oddities about your environment variables where things like GOPATH and GOCACHE directly below are /home/u (e.g. /home/u/go and /home/go/.cache, respectively), but your home directory looks like it's probably /home/u/emp3r0r. I wonder if Go perhaps doesn't have access to those other directories or if the odd configuration causes some kind of problem?

jm33-m0 commented 2 years ago

but your home directory looks like it's probably /home/u/emp3r0r

No, it's /home/u, /home/u/emp3r0r is a Go project that's stored under home directory

I wonder if Go perhaps doesn't have access to those other directories

go is installed from snap as a "classic" package that has access to full file system, it shouldn't be a problem for go to access any files

bhcleek commented 2 years ago

The only other thing that comes to mind is I wonder if vim-go is using a different go binary than you expect. Can you search your system and see if there are multiple go binaries? If there are, then I'd be interested to know the location of each, what your $PATH is, and what Go version each is.

jm33-m0 commented 2 years ago

I found only one go binary:

u in ubuntu in ~ 
❯ echo $PATH
/home/u/bin:/home/u/.local/bin:/home/u/bin:/home/u/.pyenv/shims:/home/u/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/u/go/bin

u in ubuntu in ~ 
❯ whereis go
go: /snap/bin/go /snap/bin/go.gofmt

u in ubuntu in ~ 
❯ which go
/snap/bin/go

u in ubuntu in ~ 
❯ /snap/bin/go version
go version go1.17.6 linux/amd64
jm33-m0 commented 2 years ago

I tried to execute go version in package.vim, with

let [l:out, l:err] = go#util#ExecInDir(['go', 'version'])
call go#util#EchoInfo(printf("go version => \n%s\n%s", l:out, l:err))

and I got:

vim-go: initializing gopls                                                                          
vim-go: go version =>                                                                               
vim-go:                                                                                             
vim-go: 0                                                                                           
vim-go: go list in /home/u/emp3r0r/core/lib/agent returned [, 0] 
jm33-m0 commented 2 years ago

If I execute which go in package.vim, it returns /snap/bin/go, while go blah returns nothing, neither does /snap/bin/go blah.

And l:err is always 0

bhcleek commented 2 years ago

Instead of whereis, can you try find (e.g. find / -name 'go' -type f)?

It's interesting that go version didn't provide any output either. That points to something wrong with your system, but I'm not sure what it would be. Why would go version work when you run it from the commandline, but not when executed from Vim? Does go env work when you run it from within Vim similarly to how you tried go version?

jm33-m0 commented 2 years ago

Instead of whereis, can you try find (e.g. find / -name 'go' -type f)?

Seriously I didn't install any other versions of Go

Why would go version work when you run it from the commandline, but not when executed from Vim

We can't say it didn't work, because when I go -vvv from vim, it returns 2, and go version returns 0

jm33-m0 commented 2 years ago

I wonder if it's because nvim is also a snap package... There seems to be some mess since they are both sym links to /usr/bin/snap

bhcleek commented 2 years ago

We can't say it didn't work, because when I go -vvv from vim, it returns 2, and go version returns 0

Did you do that by calling go#util#ExecInDir?

I wonder if it's because nvim is also a snap package... There seems to be some mess since they are both sym links to /usr/bin/snap

Now that's interesting. It wouldn't be that they're both symlinks, but I wouldn't be surprised if snap packages (or symlinks more generally) cause some kind of issues.

jm33-m0 commented 2 years ago

Did you do that by calling go#util#ExecInDir?

Yes, I did that in package.vim

I will install another go version in GOPATH to see if that makes any difference

bhcleek commented 2 years ago

Is your source code in a symlinked directory?

Can you try #3361 before you try using a different version of Go - I'm pretty sure this isn't related to the version of Go that you're using.

jm33-m0 commented 2 years ago

No, the source code is not symlinked, and no matter where I put it, the error persists.

I have tried #3361, it was the same error as before.

jm33-m0 commented 2 years ago

However, installing a different Go (that is not a snap) worked.

I installed Go 1.17.7 with go install golang.org/dl/go1.17.7@latest, and ln go1.17.7 go, with the hard linked go, I got:

vim-go: exec =>                                                                                     
vim-go: go version go1.17.7 linux/amd64                                                             
vim-go:                                                                                             
vim-go: 0                                                                                           
vim-go: go list in /home/u/emp3r0r/core/lib/agent returned [_/home/u/emp3r0r/core/lib/agent         
vim-go: , 0]                                                                                        
vim-go: initializing gopls                                                                          
vim-go: initialized gopls                                                                           
vim-go: Finished loading packages. 
jm33-m0 commented 2 years ago

So it's probably something wrong with the snap package

bhcleek commented 2 years ago

Yeah, that's very interesting. I wonder if there's something I can do to make it work with vim-go. In any case, I'm glad we got to the bottom of it. Thank you for taking the time to stick with me through all the analysis.

jm33-m0 commented 2 years ago

It seems to be a snap problem, I will test on a fresh VM later, hopefully I can figure out something.

peter-funktionIT commented 1 year ago

This is probably due to the go binary being a link to /usr/bin/snap which confuses... something.

With Ubuntu 22.04 and golang installed as snap I fixed this by adding the following to init.vim let $PATH = '/snap/go/current/bin:' .. $PATH