使用goinstall后导入web.go错误

使用goinstall后导入web.go错误

问题描述:

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.

带有半个建议,首先安装git后,我可以成功使用goinstall github.com/hoisie/web.go而没有任何错误。 但是,现在当我尝试编译给出的示例代码时,go找不到了Web包。 我收到错误消息 p>

  main.go:4:找不到导入:web 
  code>  pre> 
 
 

打开 此代码 p>

 包main 
 
import(
“ web” 
)
 
func hello(val字符串)字符串{返回“ hello” + val} \  n 
func main(){
 web.Get(“ /(.*)”,你好)
 web.Run(“ 0.0.0.0:9999”)
} 
  code>  pre>  
 
 

我需要做些特殊的事情来使其识别包裹吗? 我在$ GOROOT / src / pkg / github.com / hoisie / web.go / web找到了软件包的源代码。 我尝试将github.com/hoisie/web.go/web作为导入,但仍然不喜欢这样。 p> div>

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.

import web "github.com/hoisie/web.go"