使用goinstall后导入web.go报错
根据 halfdans 的建议,我成功地使用了 goinstall github.com/hoisie/web.go首先安装git后没有任何错误。但是,现在当我尝试编译给出的示例代码时,go 找不到 web 包。我收到错误,
main.go:4: can't find import: web
在此代码上
package main
import (
"web"
)
func hello(val string) string { return "hello " + val }
func main() {
web.Get("/(.*)", hello)
web.Run("0.0.0.0:9999")
}
我需要做一些特殊的事情才能使其识别该包吗?我在 $GOROOT/src/pkg/github.com/hoisie/web.go/web 找到了包源。我尝试使用 github.com/hoisie/web.go/web 作为导入,但仍然不喜欢这样。
With halfdans advice, I was successfully able to use goinstall github.com/hoisie/web.go without any errors after installing git first. However, now when I try to compile the sample code given, go is not finding the web package. I get the error,
main.go:4: can't find import: web
On this code
package main
import (
"web"
)
func hello(val string) string { return "hello " + val }
func main() {
web.Get("/(.*)", hello)
web.Run("0.0.0.0:9999")
}
Is there something special I need to do in order for it to recognize the package? I found the package source at $GOROOT/src/pkg/github.com/hoisie/web.go/web. I tried github.com/hoisie/web.go/web as the import and it still did not like that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你通过 goinstall 安装 web.go,你需要这样做:
Goinstall 仍然是一个实验性系统。如果您不必包含完整路径,那就太好了。
If you install web.go through goinstall, you need to do:
Goinstall is still an experimental system. It would be nice if you didn't have to include the full path.