GoType与SublimeLinter的问题

huangapple go评论150阅读模式
英文:

GoType issues with SublimeLinter

问题

我对Go还有点陌生,最近一直在尝试使用SublimeLinter-contrib-gotype插件来对我的文件进行代码检查。大部分情况下它都工作得很好,但是如果我尝试从GitHub导入一个Go包,它就会出错。我一直在尝试使用Echo框架的简单示例。当我运行代码时,它可以正常工作,但是代码检查工具却出现了问题。

它报错说:

> 无法导入github.com/labstack/echo(找不到导入项: )

我已经运行了go get github.com/labstack/echo命令,但似乎没有起作用。

我也附上了一张截图:

GoType与SublimeLinter的问题

这是我使用的代码的链接:这里

英文:

I'm a bit new to Go, and I've been trying to use the SublimeLinter-contrib-gotype package to lint my files. It works well for the most part, but for some reason it throws an error if I try to import a Go package from GitHub. I've been trying to use the simple example from the Echo framework. When I run the code, it works fine but for some reason the linter is causing issues.

It throws an error saying:

> could not import github.com/labstack/echo (can't find import: )

I've already run the go get github.com/labstack/echo command, but it doesn't seem to have helped.

I've attached a screenshot as well:

GoType与SublimeLinter的问题

And here is a link to the code I was using.

答案1

得分: 1

我遇到了同样的问题。尝试运行以下命令:

launchctl setenv GOPATH $GOPATH

然后重新启动 ST,但在重新启动后这个方法可能不起作用。

来源

如果你使用 Go Sublime,下面的方法可能更好用。

Sublime Text 菜单 > Preferences > Package Settings > GoSublime > Settings - Default / User

"shell": ["/usr/bin/bash"],
"env": {"GOPATH": "/Users/username/gopath/"},
英文:

I'd faced the same problem. Try running

launchctl setenv GOPATH $GOPATH

and restarting ST, this won't work after a reboot.

Source

If you use Go Sublime, the following should work better.

Sublime Text menu > Preferences > Package Settings > GoSublime > Settings - Default / User

"shell": ["/usr/bin/bash"],
"env": {"GOPATH": "/Users/username/gopath/"},

huangapple
  • 本文由 发表于 2016年3月24日 10:25:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/36192222.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定