fatih / vim-go

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

Vim-Go not working on Raspberry Pi #3598

Closed shaneHowearth closed 7 months ago

shaneHowearth commented 7 months ago

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

I have installed vim, vim-go, and go on my raspberry pi. I want to install the binaries required to code with :-) Note: delve does not install, but I will be raising an issue with them

What did you expect to happen?

What happened instead?

I got the following error (repeated for a few of the binaries):

vim-go: godef not found. Installing github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: Error installing github.com/rogpeppe/godef@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negative

I raised (then closed) an issue with the Go project https://github.com/golang/go/issues/64190 that is the source of the error

However, I cannot get GoInstallBinaries to 'work' (I /was/ able to

 $ go install github.com/rogpeppe/godef@latest

To move on to the next binary though.

Configuration (MUST fill this out):

vim-go version:

I am on MASTER branch and this is the most recent commit

$ git log -n1
commit 1401b576c6ac382529188d3d26cff866139f2f9a (HEAD -> master, origin/master, origin/HEAD)
Author: Billie Cleek <bhcleek@gmail.com>
Date:   Mon Oct 2 11:13:19 2023 -0700

    update CHANGELOG.md for #3587

vimrc you used to reproduce:

vimrc ```vim filetype plugin indent on filetype on syntax on set runtimepath^=~/.vim/bundle/vim-go "Prevent lines breaking in the middle of words set lbr "Search down into sub folders "Provides tab-completion for all file related tasks set path+=** scriptencoding utf-8 set encoding=utf-8 set listchars=eol:$,tab:░░,trail:~,extends:>,precedes:< set list set laststatus=2 " slow refresh down so multi char commands can be read in properly set timeout timeoutlen=3000 ttimeoutlen=100 let mapleader = "," let g:diff_is_on = 1 function! s:DiffToggle() if g:diff_is_on windo diffthis let g:diff_is_on = 0 else windo diffoff let g:diff_is_on = 1 endif endfunction "set c-w to a no op in insert mode ino if !exists("autocommands_loaded") let autocommands_loaded = 1 let g:go_metalinter_autosave=1 autocmd BufWritePost *.go :GoBuild endif " Go specific let g:go_metalinter_command='golangci-lint' let g:go_fmt_command = "goimports" let g:go_def_mode = "gopls" let g:go_info_mode = "gopls" let s:counter = 0 let s:timer = -1 let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_build_constraints = 1 let g:go_jump_to_error = 0 " don't jump to errors function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete setlocal signcolumn=yes if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap (lsp-definition) nmap gs (lsp-document-symbol-search) nmap gS (lsp-workspace-symbol-search) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gt (lsp-type-definition) nmap rn (lsp-rename) nmap [g (lsp-previous-diagnostic) nmap ]g (lsp-next-diagnostic) nmap K (lsp-hover) inoremap lsp#scroll(+4) inoremap lsp#scroll(-4) let g:lsp_format_sync_timeout = 1000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') endfunction autocmd FileType ruby setlocal commentstring=#\ %s set mouse=a set ttymouse=sgr set balloonexpr=go#tool#DescribeBalloon() set balloondelay=250 set ballooneval set balloonevalterm ```

Vim version (first three lines from :version):

:version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
Included patches: 1-2434
Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428

Go version (go version):

$ go version
go version go1.21.4 linux/arm64

Go environment

go env Output:

$ go env
GO111MODULE=''
GOARCH='arm'
GOBIN=''
GOCACHE='/home/shane/.cache/go-build'
GOENV='/home/shane/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/shane/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/shane/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOARM='7'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/home/shane/go/src/github.com/shanehowearth/onepage/api/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -marm -fmessage-length=0'

Note: GOARCH has been modified by me and GOHOSTARCH cannot be changed I have also tried

$ GOARCH=arm GOHOSTARCH=arm vi cmd/main.go

To no avail (they have been set in my shell (via ~/.bashrc which has been sourced) too

gopls version

gopls version Output:

$ gopls version
gopls, built in GOPATH mode master
    gopls, built in GOPATH mode@master
shaneHowearth commented 7 months ago

Note: I am on a Raspberry Pi

$ uname -rms
Linux 6.1.21-v8+ aarch64

Which I accept might be a problem :)

bhcleek commented 7 months ago

From golang/go#64190, it seems like the issue is that you need to set your go environment correctly. Have you done that and then restarted vim before trying to :GoInstallBinaries godef?

shaneHowearth commented 7 months ago

As mentioned in this issue, I've set go env "correctly" (keeping in mind that GOHOSTARCH cannot be updated) and I have set the shell env vars, and I have tried setting them when I call vim itself

shaneHowearth commented 7 months ago

Also note: GoInstallBinaries produces:

vim-go: godef not found. Installing github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: Error installing github.com/rogpeppe/godef@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negativ
e
vim-go: dlv not found. Installing github.com/go-delve/delve/cmd/dlv@latest to folder /home/shane/go/bin/
vim-go: Error installing github.com/go-delve/delve/cmd/dlv@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negativ
e
vim-go: staticcheck not found. Installing honnef.co/go/tools/cmd/staticcheck@latest to folder /home/shane/go/bin/^C
Command terminated

GoUpdateBinaries godef produces

vim-go: Updating godef. Reinstalling github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: Error installing github.com/rogpeppe/godef@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negativ
e
vim-go: updating finished!
ls ~/go/bin/
asmfmt    fillstruct  golangci-lint  gorename  guru   impl    linux_arm  revive
errcheck  goimports   gomodifytags   gotags    iferr  keyify  motion

And

 $ go install github.com/rogpeppe/godef@latest

Exits without error (presumably that means a successful installation)

edit: Apologies Update wasn't trying to get godef in the short sample time I was running it for this)

shaneHowearth commented 7 months ago

Trying:

$ GOBIN=~/go/bin GOOS=linux GOHOSTOS=linux GOARCH=arm GOHOSTARCH=arm go install github.com/rogpeppe/godef@latest
go: cannot install cross-compiled binaries when GOBIN is set

but

GOBIN=~/go/bin GOOS=linux GOHOSTOS=linux GOARCH=arm GOHOSTARCH=arm go get -u github.com/rogpeppe/godef@latest
go: downloading 9fans.net/go v0.0.4
go: downloading golang.org/x/sys v0.14.0
go: added 9fans.net/go v0.0.4
go: added github.com/rogpeppe/godef v1.1.2
go: added golang.org/x/mod v0.14.0
go: added golang.org/x/sys v0.14.0
go: added golang.org/x/tools v0.15.0

and still not happening with vim

GOBIN=~/go/bin GOOS=linux GOHOSTOS=linux GOARCH=arm GOHOSTARCH=arm vim cmd/main.go

:GoUpdateBinaries godef
vim-go: Updating godef. Reinstalling github.com/rogpeppe/godef@latest to folder /home/shane/go/bin
vim-go: Error installing github.com/rogpeppe/godef@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negative
vim-go: updating finished!
shaneHowearth commented 7 months ago

Ok, am resorting to the good old fashioned:

mkdir -p ~/go/src/github.com/rogpeppe
cd $_
git clone https://github.com/rogpeppe/godef.git
cd godef
go build .
mv godef ~/go/bin

GoUpdateBinaries still doesn't work (it's like it cannot see the file), I'll report back if I have any more progress/issues

shaneHowearth commented 7 months ago

Ok, I gave up trying to get things installed and instead tried to just use it as is.

When I try to start vim I get

"cmd/main.go" 18L, 296B
vim-go: could not determine appropriate working directory for gopls
Press ENTER or type command to continue

That error message pops up again once I enter into the code.

I had gopls installed, via

apt install gopls

but decided to try and install it in

~/go/bin

I cloned https://github.com/golang/tools/tree/master/gopls to ~/go/src/golang.org/x/tools cd into gopls/, and built it with go build ., then moved the resulting binary to ~/go/bin

But get the above error.

FTR

$ which gopls
/home/shane/go/bin/gopls

$ gopls version
golang.org/x/tools/gopls (devel)
    golang.org/x/tools/gopls@(devel)

I see in the vim-go code that the error comes from https://github.com/fatih/vim-go/blob/1401b576c6ac382529188d3d26cff866139f2f9a/autoload/go/lsp.vim#L346

But I don't know enough about vim script to be able to debug further (It seems that this line let l:wd = go#util#ModuleRoot() is producing -1, but I don't know what it /should/ be, or why it's getting that value

shaneHowearth commented 7 months ago

For some reason I was getting an error when I restarted my shell which led me to https://github.com/dependabot/dependabot-core/issues/7895

If I start vim with:

GOTOOLCHAIN="local" vi cmd/main.go

The above gopls error disappears, and I am able to start without error, but if I try to go to the definition I get a gopls error

no package metadata for file file:///path/to/file/I/am/trying/to/edit

Which either comes from https://github.com/golang/tools/blob/992d98451cb0cd4370c14e54e4262be89e83bfe2/gopls/internal/lsp/source/view.go#L272

or https://github.com/golang/tools/blob/992d98451cb0cd4370c14e54e4262be89e83bfe2/gopls/internal/lsp/source/rename.go#L307

(I suspect the former as I'm trying to view, not rename/refactor)

bhcleek commented 7 months ago

I'm not sure what's going on for sure, but I can imagine a few things.

First, can you please use vim instead of vi so that vim does not start in compatibility mode. Second, can you execute :let g:go_debug=['shell-commands'] before executing :GoInstallBinaries or :GoUpdateBinaries. You can then run :messages to see the shell commands that vim-go is executing.

shaneHowearth commented 7 months ago

Ok, vim cmd/main.go

"cmd/main.go" 18L, 296B
vim-go: shell command: 'go' 'env' 'GOBIN'
vim-go: shell command: '/usr/local/go/bin/go' 'list'
vim-go: job command: ['/home/shane/go/bin/gopls', '-remote=auto']
vim-go: shell command: '/usr/local/go/bin/go' 'env' 'GOMOD'
vim-go: shell command: '/usr/local/go/bin/go' 'env' 'GOMOD'
vim-go: could not determine appropriate working directory for gopls
Press ENTER or type command to continue

:GoInstallBinaries

vim-go: shell command: 'go' 'env' 'GOHOSTOS'
vim-go: shell command: 'go' 'env' 'GOHOSTARCH'
vim-go: dlv not found. Installing github.com/go-delve/delve/cmd/dlv@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/go-delve/delve/cmd/dlv@latest'
vim-go: Error installing github.com/go-delve/delve/cmd/dlv@latest: /home/shane/go/pkg/mod/github.com/go-delve/delve@v1
.21.2/service/debugger/debugger.go:32:2: found packages native (followexec_other.go) and your_operating_system_is_not_
supported_by_delve (support_sentinel.go) in /home/shane/go/pkg/mod/github.com/go-delve/delve@v1.21.2/pkg/proc/native
vim-go: staticcheck not found. Installing honnef.co/go/tools/cmd/staticcheck@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'honnef.co/go/tools/cmd/staticcheck@latest'
vim-go: Error installing honnef.co/go/tools/cmd/staticcheck@latest: go: cannot install cross-compiled binaries when GO
BIN is set
vim-go: installing finished!
Press ENTER or type command to continue

:GoUpdateBinaries

vim-go: Error installing github.com/davidrjenni/reftools/cmd/fillstruct@master: go: cannot install cross-compiled bina
ries when GOBIN is set
vim-go: Updating godef. Reinstalling github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/rogpeppe/godef@latest'
vim-go: Error installing github.com/rogpeppe/godef@latest: go: cannot install cross-compiled binaries when GOBIN is se
t
vim-go: Updating motion. Reinstalling github.com/fatih/motion@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/fatih/motion@latest'
vim-go: Error installing github.com/fatih/motion@latest: go: cannot install cross-compiled binaries when GOBIN is set
vim-go: Updating errcheck. Reinstalling github.com/kisielk/errcheck@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/kisielk/errcheck@latest'
vim-go: Error installing github.com/kisielk/errcheck@latest: go: cannot install cross-compiled binaries when GOBIN is
set
vim-go: Updating dlv. Reinstalling github.com/go-delve/delve/cmd/dlv@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/go-delve/delve/cmd/dlv@latest'
vim-go: Error installing github.com/go-delve/delve/cmd/dlv@latest: /home/shane/go/pkg/mod/github.com/go-delve/delve@v1
.21.2/service/debugger/debugger.go:32:2: found packages native (followexec_other.go) and your_operating_system_is_not_
supported_by_delve (support_sentinel.go) in /home/shane/go/pkg/mod/github.com/go-delve/delve@v1.21.2/pkg/proc/native
vim-go: Updating gorename. Reinstalling golang.org/x/tools/cmd/gorename@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'golang.org/x/tools/cmd/gorename@master'
vim-go: Error installing golang.org/x/tools/cmd/gorename@master: go: cannot install cross-compiled binaries when GOBIN
 is set
vim-go: Updating iferr. Reinstalling github.com/koron/iferr@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/koron/iferr@master'
vim-go: Error installing github.com/koron/iferr@master: go: cannot install cross-compiled binaries when GOBIN is set
vim-go: Updating gotags. Reinstalling github.com/jstemmer/gotags@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/jstemmer/gotags@master'
vim-go: Error installing github.com/jstemmer/gotags@master: go: cannot install cross-compiled binaries when GOBIN is s
et
vim-go: Updating impl. Reinstalling github.com/josharian/impl@main to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/josharian/impl@main'
vim-go: Error installing github.com/josharian/impl@main: go: cannot install cross-compiled binaries when GOBIN is set
vim-go: Updating goimports. Reinstalling golang.org/x/tools/cmd/goimports@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'golang.org/x/tools/cmd/goimports@master'
vim-go: Error installing golang.org/x/tools/cmd/goimports@master: go: cannot install cross-compiled binaries when GOBI
N is set
vim-go: Updating golangci-lint. Reinstalling github.com/golangci/golangci-lint/cmd/golangci-lint@latest to folder /hom
e/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/golangci/golangci-lint/cmd/golangc
i-lint@latest'
vim-go: Error installing github.com/golangci/golangci-lint/cmd/golangci-lint@latest: go: cannot install cross-compiled
 binaries when GOBIN is set
vim-go: Updating gomodifytags. Reinstalling github.com/fatih/gomodifytags@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/fatih/gomodifytags@latest'
vim-go: Error installing github.com/fatih/gomodifytags@latest: go: cannot install cross-compiled binaries when GOBIN i
s set
vim-go: Updating keyify. Reinstalling honnef.co/go/tools/cmd/keyify@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'honnef.co/go/tools/cmd/keyify@master'
vim-go: Error installing honnef.co/go/tools/cmd/keyify@master: go: cannot install cross-compiled binaries when GOBIN i
s set
vim-go: Updating staticcheck. Reinstalling honnef.co/go/tools/cmd/staticcheck@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'honnef.co/go/tools/cmd/staticcheck@latest'
vim-go: Error installing honnef.co/go/tools/cmd/staticcheck@latest: go: cannot install cross-compiled binaries when GO
BIN is set
vim-go: Updating asmfmt. Reinstalling github.com/klauspost/asmfmt/cmd/asmfmt@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/klauspost/asmfmt/cmd/asmfmt@latest
'
vim-go: Error installing github.com/klauspost/asmfmt/cmd/asmfmt@latest: go: cannot install cross-compiled binaries when GOBIN is set
vim-go: updating finished!
Press ENTER or type command to continue

FTR this is the error I am getting that motivated me to find the GOTOOLCHAIN environment variable

go env |grep -i bin
go: downloading go1.24 (linux/arm64)
go: download go1.24 for linux/arm64: toolchain not available

I cannot find where GOBIN might be set - its not in go env nor my shell

shaneHowearth commented 7 months ago

I started vim with GOTOOLCHAIN="local" vim cmd/main.go and got these errors (it's a sample because there were too much and copy/paste inside tmux isn't flash for me at the minute)

vim-go: Updating fillstruct. Reinstalling github.com/davidrjenni/reftools/cmd/fillstruct@master to folder /home/shane/
go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/davidrjenni/reftools/cmd/fillstruc
t@master'
vim-go: Updating godef. Reinstalling github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/rogpeppe/godef@latest'
vim-go: Error installing github.com/rogpeppe/godef@latest: runtime/cgo
vim-go: # runtime/cgo
vim-go: In file included from _cgo_export.c:4:
vim-go: cgo-gcc-export-header-prolog:31:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negativ
e
vim-go: Updating motion. Reinstalling github.com/fatih/motion@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/fatih/motion@latest'
vim-go: Updating errcheck. Reinstalling github.com/kisielk/errcheck@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/kisielk/errcheck@latest'
vim-go: Updating dlv. Reinstalling github.com/go-delve/delve/cmd/dlv@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/go-delve/delve/cmd/dlv@latest'
shaneHowearth commented 7 months ago
GOTOOLCHAIN="local" go install -v github.com/rogpeppe/godef@latest

and

GOTOOLCHAIN="local" go install -v -mod=mod github.com/rogpeppe/godef@latest

Aren't doing anything either - I think that I will raise that with the Go project

shaneHowearth commented 7 months ago

I notice that vim-go starts with

vim-go: shell command: 'go' 'env' 'GOHOSTOS'
vim-go: shell command: 'go' 'env' 'GOHOSTARCH'

but I know that GOHOSTARCH is arm64 and cannot be changed to arm - is there a way to get vim-go to use the ENV VARS that I pass/set rather than go env ?

bhcleek commented 7 months ago

Vim-go uses go env to get GOHOSTOS and GOHOSTARCH values and then sets GOOS and GOARCH to those values before installing the binaries. Why is your GOHOSTARCH reporting arm64 instead of arm? 🤔 That certainly seems to be the root of this problem, as the arm64 value then causes problems when cgo checks with cgo-gcc-export-header-prolog.

shaneHowearth commented 7 months ago

I don't know /why/ it's doing that, I only know that it is (and even then I only stumbled on the solution).

The question is, how can I get vim-go to use the supplied values and /not/ the go env values, which I cannot change apparently

bhcleek commented 7 months ago

Vim-go doesn't have a way to change that currently, specifically because it's building the binaries for the host system and it needs to override any cross compilation that would otherwise occur when GOOS and GOARCH vary from GOHOSTOS and GOHOSTARCH.

I wonder if disabling cgo might not avoid this for you. Can you try CGO_ENABLED=0 vim and then execute :GoUpdateBinaries?

There seem to be two possible solutions to your difficulties if disabling cgo doesn't work.

First, we could change vim-go so that if GOHOSTARCH is greater than GOARCH, then vim-go would not set GOARCH to GOHOSTARCH. I'm a little hesitant to do that, but perhaps it's worth doing for the arm64 vs arm case because of Raspberry Pi.

The second option is that you can manually build the binaries that are leveraging cgo.

shaneHowearth commented 7 months ago

Ok, GOTOOLCHAIN="local" CGO_ENABLED=0 vim seems to have produced the desired outcome

vim-go: Updating guru. Reinstalling golang.org/x/tools/cmd/guru@master to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'golang.org/x/tools/cmd/guru@master'
vim-go: Updating gopls. Reinstalling golang.org/x/tools/gopls@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'golang.org/x/tools/gopls@latest'
vim-go: Updating fillstruct. Reinstalling github.com/davidrjenni/reftools/cmd/fillstruct@master to folder /home/shane/
go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/davidrjenni/reftools/cmd/fillstruc
t@master'
vim-go: Updating godef. Reinstalling github.com/rogpeppe/godef@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/rogpeppe/godef@latest'
vim-go: Updating motion. Reinstalling github.com/fatih/motion@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/fatih/motion@latest'
vim-go: Updating errcheck. Reinstalling github.com/kisielk/errcheck@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/kisielk/errcheck@latest'
vim-go: Updating dlv. Reinstalling github.com/go-delve/delve/cmd/dlv@latest to folder /home/shane/go/bin/
vim-go: shell command: '/usr/local/go/bin/go' 'install' '-v' '-mod=mod' 'github.com/go-delve/delve/cmd/dlv@latest

It's completed, but gopls isn't taking me to the definition of chi.NewRouter()

With the error:

vim-go: no package metadata for file file:///home/shane/go/src/github.com/shanehowearth/projectX/api/cmd/main.go
shaneHowearth commented 7 months ago

I've just discovered that my go.mod was wildly inaccurate - it had a go version of 1.24, but the version on the machine is only 1.21.4 - fixing that seems to have got things working properly now

shaneHowearth commented 7 months ago

I think that this is solved now