ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.91k stars 119 forks source link

[Suggestion] Use `go env GOPATH` instead of requiring GOPATH env variable #382

Closed ribtoks closed 7 months ago

ribtoks commented 9 months ago

Hi

Thank you for developing go.nvim plugin!

I had a problem today (described in #381) where my configuration was not applied, because go.nvim was not able to find gopls which go.nvim has just installed with :GoInstallBinaries for some reason. (:checkhealth showed few warnings such as "GOBIN is not set")

I think that there's a gopls detection problem in this plugin, which might or might not be related to environmental variables such as GOPATH and GOBIN and I think it might help to use go env VAR for such cases.

Cheers

ray-x commented 7 months ago

Not 100% on your side. 1> Tools can be installed in different ways, e.g. pacman brew apt mason, choco. The go.nvim only install with go install giving go installed 2> Installer.lua will check if the binary is installed in PATH and all the tools run without specifying the full path. So I will expect the tools to be in PATH otherwise it will be painful to update all those components. especially considering Windows used a totally different path schema.

What I can do is check GOBIN is added to PATH. Which is included in the commit above.