Sono nuovo e sto lavorando su un codice di esempio che voglio localizzare.
Nella main.godichiarazione di importazione originale era:
import (
"log"
"net/http"
"github.com/foo/bar/myapp/common"
"github.com/foo/bar/myapp/routers"
)
Ora ho commone routerspacchetto/home/me/go/src/myapp
Quindi ho convertito l'istruzione import in:
import (
"log"
"net/http"
"./common"
"./routers"
)
Ma quando corro go install myappottengo questi errori:
can't load package: /home/me/go/src/myapp/main.go:7:3: local import "./common" in non-local package
Inoltre, quando uso commone routersinvece di ./commone ./routersnell'istruzione import, ottengo:
myapp/main.go:7:3: cannot find package "common" in any of:
/usr/local/go/src/common (from $GOROOT)
/home/me/go/src/common (from $GOPATH)
myapp/main.go:8:2: cannot find package "routers" in any of:
/usr/local/go/src/routers (from $GOROOT)
/home/me/go/src/routers (from $GOPATH)
Come posso risolvere questo problema?