如何在 Windows 的 sublime text 3 中设置 Gosublime?

How to setup Gosublime in sublime text 3 in Windows?

这里的主要问题是..我已经安装了 package control 和 gosublime 插件,但是它不工作。当我键入 go 时,它在命令提示符下也不起作用。它提供的信息证明 go 已正确安装在路径中我实际上正在尝试使用分隔符同时设置 go 和 java 的路径,这可能是我做错了。

ENVIRONMENT VARIABLE

现在在 sublime text 3 中我收到一个错误

MarGo: Missing required environment variables: GOPATH | > See the Quirks section of USAGE.md for info

我经历过这个,但对我没有帮助

您必须将 GOPATH 环境变量设置为类似 d:\myprojects\go 的值。这就是您的代码和库将被存储的地方。

您的代码应位于 d:\myprojects\go\src\github.com\pandey\coolproject.

这样的文件夹中

文档中的相关部分:

[...]

Test your installation

Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.

Create a directory to contain your workspace, $HOME/work for example, and set the GOPATH environment variable to point to that location.

$ export GOPATH=$HOME/work You should put the above command in your shell startup script ($HOME/.profile for example) or, if you use Windows, follow the instructions above to set the GOPATH environment variable on your system.

Next, make the directories src/github.com/user/hello inside your workspace (if you use GitHub, substitute your user name for user), and inside the hello directory create a file named hello.go with the following contents:

[...]

(https://golang.org/doc/install#testing)

有关详细信息,请参阅 Go 文档,尤其是关于如何在 windows 上执行此操作的信息:https://golang.org/doc/install

在 windows sublime text 3
ctrl+shift+p
输入安装包输入
搜索 golang build 输入

最近安装gosublime的体验不是很好,margo的说明帮助不大。您可以试试 gopls,它仍处于 alpha 阶段,但它是由 go 团队开发的。这是一个 go 语言服务器,可与 Sublime LSP 插件一起使用。

https://github.com/golang/tools/tree/master/gopls

Sublime 说明 are here