使用goinstall后导入web.go错误 [英] Import web.go error after using goinstall
问题描述
使用 halfdans建议,我成功地使用了goinstall github.com/hoisie/ web.go首先安装git后没有任何错误。但是,现在当我尝试编译给定的示例代码时,就不会找到Web包。我收到错误消息:
main.go:4:找不到导入:web
$ c
$ b $ p
$ b $ p $ package main
$ b func hello(val string)string {returnhello+ 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作为导入,但它仍然不喜欢这样做。
如果你需要这样做:
importgithub.com/hoisie/web.go
Goinstall仍然是一个实验系统。如果您不必包含完整路径,那将会很好。
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.
If you install web.go through goinstall, you need to do:
import "github.com/hoisie/web.go"
Goinstall is still an experimental system. It would be nice if you didn't have to include the full path.
这篇关于使用goinstall后导入web.go错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!