在 Sublime 3 的 Debian 测试中启用/检测 GoSublime + Linters 时遇到问题。我在 OSX 和 Windows 机器上做了六次,没有失败。
ST 控制台说:
SublimeLinter: debug mode: off
SublimeLinter: annotations activated: <builtin>
SublimeLinter: WARNING: golint deactivated, cannot locate 'golint'
SublimeLinter: WARNING: gotype deactivated, cannot locate 'gotype'
SublimeLinter: WARNING: govet deactivated, cannot locate 'go'
有趣的是,它说它无法定位go
,因为我之前在设置以前的错误(我已修复)时没有注意到它。Go 就在那里,正如 GoSublime 所示:
GoSblime r13.12.26-3 sh: load env vars ['/bin/bash', '--login', '-c', 'echo "..."']: go version: ['/usr/local/go/bin/go', 'version'] -> `go version go1.3.1 linux/amd64
` -> `go1.3.1`: 0.043s
GoSublime r13.12.26-3: init mod(mg9)
SublimeLinter: debug mode: off
SublimeLinter: json activated: <builtin>
SublimeLinter: annotations activated: <builtin>
** 2014-09-18 08:48:11.608847 **:
GoSublime init r13.12.26-3 (0.001s)
| install margo: no
| install state: done
| sublime.version: 3065
| sublime.channel: stable
| about.ann: a14.02.25-1
| about.version: r13.12.26-3
| version: r13.12.26-3
| platform: linux-x64
| ~bin: ~/.config/sublime-text-3/Packages/User/GoSublime/linux-x64/bin
| margo.exe: ~bin/gosublime.margo_r13.12.26-3_go1.3.1.exe (ok)
| go.exe: /usr/local/go/bin/go (ok)
| go.version: go1.3.1
| GOROOT: /usr/local/go
| GOPATH: ~/go
| GOBIN: (not set) (should usually be `(not set)`)
| set.shell: ['/bin/bash', '--login', '-c', '$CMD']
| env.shell: /bin/bash
| shell.cmd: ['/bin/bash', '--login', '-c', '${CMD}']
--------------------------------
GOBIN(未设置)是另一个有趣的,我承认我以前在其他系统上没有关注过。
所以这是我想象的从 GoSublime 插件代理的 Linter 插件配置的问题?我相信我设置正确,因为我复制并粘贴目录并且它们在终端中运行(告诉我没有 typeo)。
# GoSublime.sublime-settings (User)
{
"env": {
"GOROOT": "/usr/local/go",
"GOPATH": "$HOME/go",
"PATH": "$PATH:$GOROOT/bin:$GOPATH/bin"
}
}
MarGo 也没有抱怨它再也找不到 GOPATH 了。所以,我确实设置正确并且它被检测到。
今天我什至深入研究了精彩的 GoSublime 设置来尝试解决这个问题,并找到了关于设置我可以为 bash 指定的 shell 命令的金块;所以,我现在有这个:
"shell": ["/bin/bash", "--login", "-c", "$CMD"],
"env": {
"GOROOT": "/usr/local/go",
"GOPATH": "$HOME/go",
"PATH": "$PATH:$GOROOT/bin:$GOPATH/bin"
},
但这也无济于事。
使用以下内容:
Debian Testing (all updated packages)
i3 Window Manager (though I don't think this worked with Gnome)
Go 1.3.1 (built from source release, located at /usr/local/go)
SublimeText 3 3065 (registered)
GoSublime (latest as of posting)
go get github.com/golang/lint (and working in terminal)
go get code.google.com/p/go.tools/cmd/gotype (works in terminal)
go vet (working in terminal)
所有路径均已正确设置。
# i3wm
exec GOPATH="$HOME/go"
exec GOROOT="/usr/local/go"
exec PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
# .bashrc
export GOPATH="$HOME/go"
export GOROOT="/usr/local/go"
PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
这些工作正常,我可以从终端和 i3 运行 Go 命令、安装包等(在 Go 中编写一些自定义状态栏)。
GoType 和 GoLint 也已安装,我可以从 bash 运行它们。
一般的 SublimeLinter 加载了正确的 linter。
reloading plugin SublimeLinter-annotations.linter
SublimeLinter: annotations linter loaded
reloading plugin SublimeLinter-contrib-golint.linter
SublimeLinter: golint linter loaded
reloading plugin SublimeLinter-contrib-gotype.linter
SublimeLinter: gotype linter loaded
reloading plugin SublimeLinter-contrib-govet.linter
SublimeLinter: govet linter loaded
reloading plugin SublimeLinter-json.linter
SublimeLinter: json linter loaded
reloading plugin sublimelint.commands
reloading plugin sublimelint.sublimelint
但是,我继续收到开头提到的这些错误。
提前致谢!