Import web.go error after using goinstall

451 views Asked by At

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.

2

There are 2 answers

6
marketer On BEST ANSWER

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.

0
elimisteve On
import web "github.com/hoisie/web.go"