安装软件包后,我在 Sublime Text 中不断收到此错误gofmt:Traceback (most recent call last): File "/Users/abrahma/Library/Application Support/Sublime Text 3/Installed Packages/Gofmt.sublime-package/gofmt.py", line 257, in run_formatter formatter = Formatter(view) File "/Users/abrahma/Library/Application Support/Sublime Text 3/Installed Packages/Gofmt.sublime-package/gofmt.py", line 166, in __init__ self.cmds = [Command(cmd, self.view, self.window) for cmd in cmds] File "/Users/abrahma/Library/Application Support/Sublime Text 3/Installed Packages/Gofmt.sublime-package/gofmt.py", line 166, in <listcomp> self.cmds = [Command(cmd, self.view, self.window) for cmd in cmds] File "/Users/abrahma/Library/Application Support/Sublime Text 3/Installed Packages/Gofmt.sublime-package/gofmt.py", line 77, in __init__ self.window) File "/Users/abrahma/Library/Application Support/Sublime Text 3/Packages/golangconfig/all/golangconfig.py", line 227, in subprocess_info raise exceptiongolangconfig.EnvVarError: The following environment variable is currently unset: GOPATH我的 `` 文件具有以下内容: "env" : { "GOPATH" : "/Users/abrahma/git/go", "GOROOT" : "/usr/local/Cellar/go/1.12.7/libexec", }(与我终端上的输出相匹配go env)我还有一个包含golang.sublime-settings以下内容的文件:{ "env" : { "GOPATH" : "/Users/abrahma/git/go", "GOROOT" : "/usr/local/Cellar/go/1.12.7/libexec", }}因此,由于某种原因,GOPATH上述内容显然没有被采纳,有什么想法吗?
2 回答
冉冉说
TA贡献1877条经验 获得超1个赞
本文档中提到了在不同操作系统上设置变量的说明 https://github.com/golang/sublime-config/blob/master/docs/user.md
我在 macOS 中使用 Sublime3 和 GolangConfig 并遇到了同样的错误。设置以下内容golang.sublime-settings帮助我解决了这个问题。
{
"PATH": "/Users/suryapandian/go/bin",
"GOPATH": "/Users/suryapandian/go"
}
注:附上下面的图片以查找golang.sublime-settings
- 2 回答
- 0 关注
- 209 浏览
添加回答
举报
0/150
提交
取消