【发布时间】:2017-02-23 06:34:47
【问题描述】:
我按照一些网页的说明安装 Sublime Text 3 并使用包控制安装 Gosublime,然后更改其用户默认文件:
{
"env": {
"GOROOT": "d:\\go",
"GOPATH": "d:\\go\workspace",
"path: "d:\\go\\workspace\\bin"
}
}
其中 d:\go 是我之前下载并安装的 golang 环境,d:\go 是我建立的工作空间。现在我想安装gocode。我重新启动 Sublime Text 3,然后显示控制台。文我进入
git get github.com/nsf/gocode
它显示:
>>> go
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'go' is not defined
以下是完整的控制台日志供参考:
GoSublime init r17.02.16-1 (0.001s)
| install margo: no
| install state: done
| sublime.version: 3126
| sublime.channel: stable
| about.ann: a17.02.16-1
| about.version: r17.02.16-1
| version: r17.02.16-1
| platform: windows-x64
| ~bin: ~\AppData\Roaming\Sublime Text 3\Packages\User\GoSublime\windows-x64\bin
| margo.exe: ~bin\gosublime.margo_r17.02.16-1_go1.8.exe (ok)
| go.exe: d:\go\bin\go.exe (ok)
| go.version: go1.8
| GOROOT: d:\go
| GOPATH: d:\go\workspace
| GOBIN: (not set) (should usually be `(not set)`)
| set.shell: []
| env.shell:
| shell.cmd: ['C:\\windows\\system32\\cmd.exe', '/C', '${CMD}']
--------------------------------
Package Control: Skipping automatic upgrade, last run at 2017-02-23 14:07:30, next run at 2017-02-23 15:07:30 or after
>>> go
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'go' is not defined
>>> go get github.com/nsf/gocode
File "<string>", line 1
go get github.com/nsf/gocode
^
SyntaxError: invalid syntax
但如果我运行 cmd.com 并输入相同的命令,它运行正常。我错过了什么?
【问题讨论】:
-
Sublime 的控制台是一个 Python 控制台,它不是用来执行随机的 shell 命令的——也许你想改用构建系统?
-
谢谢,基思。这是我第一次使用 Sublime Text。如何使用“构建系统”。
标签: go sublimetext3