Metropolis
Metropolis

Reputation: 6622

Import web.go error after using 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.

Upvotes: 1

Views: 449

Answers (2)

elimisteve
elimisteve

Reputation: 1831

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

Upvotes: 2

marketer
marketer

Reputation: 43677

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.

Upvotes: 3

Related Questions