Table of Contents
Question content
Workaround
Home Backend Development Golang LSP-gopls in Sublime Text creates go directory in $HOME instead of custom location

LSP-gopls in Sublime Text creates go directory in $HOME instead of custom location

Feb 13, 2024 pm 12:12 PM
lsp

Sublime Text 中的 LSP-gopls 在 $HOME 中创建 go 目录而不是自定义位置

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.

Question content

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"].

Workaround

Turns out I needed to set $GOMODCACHE in the LSP-golsp settings.

"settings": {
  "gopls.env": {"GOMODCACHE":"/Users/user/Code/go/pkg/mod"}
}
Copy after login

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to hide photo album on Redmi Note13RPro? How to hide photo album on Redmi Note13RPro? May 01, 2024 pm 12:50 PM

How to hide photo album on Redmi Note13RPro?

How to adjust the font size on Redmi Note13RPro? How to adjust the font size on Redmi Note13RPro? May 07, 2024 pm 06:34 PM

How to adjust the font size on Redmi Note13RPro?

How to set dynamic wallpaper on Redmi Note13RPro? How to set dynamic wallpaper on Redmi Note13RPro? Apr 28, 2024 pm 06:49 PM

How to set dynamic wallpaper on Redmi Note13RPro?

How to connect Redmi Note13RPro to the computer? How to connect Redmi Note13RPro to the computer? May 09, 2024 pm 06:52 PM

How to connect Redmi Note13RPro to the computer?

How to extract text from pictures on Redmi Note13RPro? How to extract text from pictures on Redmi Note13RPro? May 08, 2024 pm 10:00 PM

How to extract text from pictures on Redmi Note13RPro?

How to turn off the camera sound on Redmi Note13RPro? How to turn off the camera sound on Redmi Note13RPro? May 02, 2024 pm 06:31 PM

How to turn off the camera sound on Redmi Note13RPro?

A complete guide to all levels of 'Whole Life' A complete guide to all levels of 'Whole Life' May 07, 2024 pm 06:31 PM

A complete guide to all levels of 'Whole Life'

How to adjust the font size on Redmi Note13RPro? How to adjust the font size on Redmi Note13RPro? Apr 29, 2024 pm 07:22 PM

How to adjust the font size on Redmi Note13RPro?

See all articles