在崇高3中的Debian测试中,启用/检测到GoSublime + times有问题。我在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,因为我以前在设置以前的错误(我修复的错误)时没有注意到这一点。如GoSublime所示,Go就在那里:
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 ( another )是另一个有趣的,我承认我以前在其他系统上没有注意到。
因此,这是一个问题,Linter插件配置,是代理从GoSublime插件,我可以想象吗?我相信我的设置是正确的,因为我复制了-n-粘贴目录,它们在终端中工作(告诉我没有打字机)。
# 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包含正确的指针。
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但是,我仍然像一开始提到的那样,继续犯这些错误。
提前感谢!
发布于 2014-10-08 21:56:59
我修好了。问题在于对bash配置文件缺乏了解。我在SublimeLinter页面上找到了用于自定义指针故障排除的详细信息。
http://www.sublimelinter.com/en/latest/troubleshooting.html#special-considerations-for-bash
打开调试时,我看到SublimeLinter正在使用的扩展路径不包括任何自定义路径设置。
简短答覆:
GO变量移动到.bash_profile文件PATH变量移动到同一个.bash_profile文件.bashrc文件中添加一行以执行交互式终端的.bash_profile文件(下面是Linux用户的更长答案)
启动终端时,这是一个“交互式”bash。bash只读取.bashrc文件,我已经正确设置了该文件。我没有.bash_profile,因为我的.bashrc可以很好地处理与所有设置交互的shell。
但是在SublimeLinter内部,它加载了一个“登录”bash -这不是交互式的。在Linux上,这只加载.bash_profile文件,而不是.bashrc文件。
解决办法:
.bashrc文件的顶部:
源~/..bash剖面.bash_profile文件中。确保将它们从.bashrc中删除。好了。关闭崇高并重新开放。这条路现在被正确地拾起了。
这是因为source ~/.bash_profile文件是在您打开的每个交互终端上读取的,因为在那里使用了.bashrc文件。但是对于登录会话,例如来自SublimeLinter的会话,只使用.bash_profile --您的.bashrc不被执行。
因此,您希望只在.bash_profile中指定自定义GO变量(GOROOT、GOPATH等),而不是在.bashrc中。但是,为了从交互式shell(例如终端)读取这个.bash_profile文件,您必须执行该.bash_profile。我们将在.bashrc文件的顶部添加第一行:source ~/.bash_profile。这将运行自定义GO变量中的概要脚本以及所有自定义路径变量。
(关于OSX)请参阅本评论中的第一个链接。
您可以在这里阅读更多关于bash文件的内容:vs.html
https://stackoverflow.com/questions/25913635
复制相似问题