Home > Article > Backend Development > LSP-gopls in Sublime Text creates go directory in $HOME instead of custom location
php editor Xinyi discovered that some users recently reported that the LSP-gopls plug-in in Sublime Text would create go folders in the $HOME directory during the installation process, instead of according to the user Custom location. This issue may cause some inconvenience to users, so we provide a solution here.
I use Sublime Text and the LSP-gopls plugin for Go development, and I have a custom GOPATH
setting: $HOME/Code/ go
instead of $HOME/go
.
However, every time I run Sublime Text, the directory go/pkg/mod/...
is created inside the $HOME
directory. Normally, LSP-gopls should store these files in the directory specified by $GOPATH
, but it uses the default directory.
How to solve?
I'm sure it's LSP-gopls because when I disable it, delete the directory in $HOME
and restart Sublime Text, this behavior goes away. I have export GOPATH=$HOME/Code/go
in .zshrc
. In the plugin settings, set the custom path to gopls
to "command" : ["/Users/user/Code/go/bin/gopls"]
.
Turns out I needed to set $GOMODCACHE
in the LSP-golsp settings.
"settings": { "gopls.env": {"GOMODCACHE":"/Users/user/Code/go/pkg/mod"} }
The above is the detailed content of LSP-gopls in Sublime Text creates go directory in $HOME instead of custom location. For more information, please follow other related articles on the PHP Chinese website!