英文:
How to setup Gosublime in sublime text 3 in Windows?
问题
这里的主要问题是,我已经安装了package control和gosublime插件,但它们都无法正常工作。当我在命令提示符中输入go时,它也无法正常工作。它提供了一些信息,证明go已经正确安装在路径中。我实际上正在尝试使用一个分隔符同时设置go和java的路径,可能我做错了。
在Sublime Text 3中,我收到了一个错误信息:
> MarGo: 缺少必需的环境变量:GOPATH
| > 请参阅USAGE.md中的“Quirks”部分获取信息
我查看了这个链接,但没有帮助我:
英文:
The main problem here is .. that I have installed the package control and also the gosublime plugin but it is not working. Also it is not working in the command prompt when I type go. It gives info proving that the go is installed correctly in path I am actually trying to use a separator to set paths for go and java simultaneously which I might be doing wrong.
Now in sublime text 3 i am receiving an error as
> MarGo: Missing required environment variables: GOPATH
| > See the Quirks
section of USAGE.md for info
I went through this but it didnt help me
答案1
得分: 2
在Windows中,打开Sublime Text 3,按下Ctrl+Shift+P,然后输入install package并按下回车。接着搜索golang build并按下回车。
英文:
in windows sublime text 3<br>
ctrl+shift+p <br>
type install package enter <br>
search for golang build enter
答案2
得分: 1
你需要将GOPATH
环境变量设置为类似于d:\myprojects\go
的路径。这是你的代码和库存储的位置。
你的代码应该位于类似于d:\myprojects\go\src\github.com\pandey\coolproject
的文件夹中。
文档中相关的部分如下:
[...]
测试你的安装
通过设置工作区并构建一个简单的程序来检查Go是否正确安装,具体步骤如下。
创建一个目录来存放你的工作区,例如$HOME/work,并将GOPATH环境变量设置为指向该位置。
$ export GOPATH=$HOME/work 你应该将上述命令放在你的shell启动脚本中(例如$HOME/.profile),如果你使用Windows,请按照上述说明设置GOPATH环境变量。
接下来,在你的工作区内创建目录src/github.com/user/hello(如果你使用GitHub,请用你的用户名替换user),在hello目录内创建一个名为hello.go的文件,内容如下:
[...]
(https://golang.org/doc/install#testing)
请参阅Go文档以获取更多详细信息,特别是关于如何在Windows上进行设置的部分:https://golang.org/doc/install
英文:
You have to set the GOPATH
environment variable to something like d:\myprojects\go
. That's where your code and libraries will be stored.
Your code should be located in a folder like d:\myprojects\go\src\github.com\pandey\coolproject
.
Relevant section from the docs:
> [...]
>
> 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)
See the Go docs for more details, especially on how to do it on windows: https://golang.org/doc/install
答案3
得分: 0
我最近在安装gosublime时遇到了一些问题,margo的说明并不是很有帮助。你可以尝试使用gopls,它仍处于alpha版本,但是它是由Go团队开发的。它是一个适用于Go语言的语言服务器,可以与Sublime的LSP插件一起使用。
https://github.com/golang/tools/tree/master/gopls
有关Sublime的说明,请参阅这里。
英文:
I haven't had a good experience installing gosublime recently, the margo instructions are not very helpful. You could try gopls instead, it's still in alpha, but it's developed by the go team. It's a language server for go, that works with a Sublime LSP plugin.
https://github.com/golang/tools/tree/master/gopls
Instructions for Sublime are here.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论