Beego: 'cannot find package "github.com/astaxie/beego" in any of'

Created on 10 Jan 2017  ·  9Comments  ·  Source: astaxie/beego

Hello

I'm using go1.1 and bee 1.6.2 and while running 'bee run' I'm getting this error:
(cannot find package "github.com/astaxie/beego" in any of..)

What causes that?

Thank you

2017/01/10 13:57:39 INFO     â¶ 0001 Using 'gett' as 'appname'
2017/01/10 13:57:39 INFO     â¶ 0002 Loading default configuration...
2017/01/10 13:57:39 INFO     â¶ 0003 Initializing watcher...
2017/01/10 13:57:39 INFO     â¶ 0004 Watching: /home/ubuntu/.gvm/pkgsets/go1.1/global/src/gett/controllers
2017/01/10 13:57:39 INFO     â¶ 0005 Watching: /home/ubuntu/.gvm/pkgsets/go1.1/global/src/gett
2017/01/10 13:57:39 INFO     â¶ 0006 Watching: /home/ubuntu/.gvm/pkgsets/go1.1/global/src/gett/models
2017/01/10 13:57:39 INFO     â¶ 0007 Watching: /home/ubuntu/.gvm/pkgsets/go1.1/global/src/gett/routers
controllers/drivers.go:10:2: cannot find package "github.com/astaxie/beego" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/astaxie/beego (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/astaxie/beego (from $GOPATH)
models/drivers.go:10:2: cannot find package "github.com/astaxie/beego/orm" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/astaxie/beego/orm (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/astaxie/beego/orm (from $GOPATH)
main.go:8:2: cannot find package "github.com/go-sql-driver/mysql" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/go-sql-driver/mysql (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/go-sql-driver/mysql (from $GOPATH)
2017/01/10 13:57:39 ERROR    â¶ 0008 Failed to build the application: controllers/drivers.go:10:2: cannot find package "github.com/astaxie/beego" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/astaxie/beego (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/astaxie/beego (from $GOPATH)
models/drivers.go:10:2: cannot find package "github.com/astaxie/beego/orm" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/astaxie/beego/orm (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/astaxie/beego/orm (from $GOPATH)
main.go:8:2: cannot find package "github.com/go-sql-driver/mysql" in any of:
        /home/ubuntu/.gvm/gos/go1.1/src/github.com/go-sql-driver/mysql (from $GOROOT)
        /home/ubuntu/.gvm/pkgsets/go1.1/global/src/github.com/go-sql-driver/mysql (from $GOPATH)

Most helpful comment

running

 go get -u github.com/astaxie/beego
 go get -u github.com/beego/bee

solved it, thank you

All 9 comments

@shlomitsur Did you check if GOPATH is set or not?

GOPATHis set to /home/ubuntu/.gvm/pkgsets/go1.1/global

running

 go get -u github.com/astaxie/beego
 go get -u github.com/beego/bee

solved it, thank you

Mentioning bee run, I thought you already did it :). Glad it works!

Thanks :)

I created a project with Docker also had this issue, and my Dockerfile as below.

FROM golang:latest
MAINTAINER N.Y. <[email protected]>

RUN go get -u github.com/astaxie/beego
RUN go get -u github.com/beego/bee

I tried to insert RUN go get -u github.com/go-sql-driver/mysql, and it worked.

FROM golang:latest
MAINTAINER N.Y. <[email protected]>

RUN go get -u github.com/go-sql-driver/mysql
RUN go get -u github.com/astaxie/beego
RUN go get -u github.com/beego/bee

EXPOSE 8080

@niyaoyao Did you try bee dockerize? Should generate a Dockerfile for your application.

try to use export GO111MODULE=on
make gomod available.

Was this page helpful?
0 / 5 - 0 ratings