beego之bee run报错解决办法

go mod init 一下就可以了

liyongjun@liyongjun-VirtualBox:~/mygo/src$ bee new hello
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/11/11 23:02:09 INFO     ▶ 0001 Creating application...create	 /home/liyongjun/mygo/src/hello/create	 /home/liyongjun/mygo/src/hello/conf/create	 /home/liyongjun/mygo/src/hello/controllers/create	 /home/liyongjun/mygo/src/hello/models/create	 /home/liyongjun/mygo/src/hello/routers/create	 /home/liyongjun/mygo/src/hello/tests/create	 /home/liyongjun/mygo/src/hello/static/create	 /home/liyongjun/mygo/src/hello/static/js/create	 /home/liyongjun/mygo/src/hello/static/css/create	 /home/liyongjun/mygo/src/hello/static/img/create	 /home/liyongjun/mygo/src/hello/views/create	 /home/liyongjun/mygo/src/hello/conf/app.confcreate	 /home/liyongjun/mygo/src/hello/controllers/default.gocreate	 /home/liyongjun/mygo/src/hello/views/index.tplcreate	 /home/liyongjun/mygo/src/hello/routers/router.gocreate	 /home/liyongjun/mygo/src/hello/tests/default_test.gocreate	 /home/liyongjun/mygo/src/hello/main.go
2019/11/11 23:02:09 SUCCESS  ▶ 0002 New application successfully created!
liyongjun@liyongjun-VirtualBox:~/mygo/src$ cd hello/
liyongjun@liyongjun-VirtualBox:~/mygo/src/hello$ bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/11/11 23:02:17 INFO     ▶ 0001 Using 'hello' as 'appname'
2019/11/11 23:02:17 INFO     ▶ 0002 Initializing watcher...
go: cannot find main module; see 'go help modules'
2019/11/11 23:02:17 ERROR    ▶ 0003 Failed to build the application: go: cannot find main module; see 'go help modules'^C
liyongjun@liyongjun-VirtualBox:~/mygo/src/hello$ go mod init
go: creating new go.mod: module hello
liyongjun@liyongjun-VirtualBox:~/mygo/src/hello$ bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/11/11 23:02:28 INFO     ▶ 0001 Using 'hello' as 'appname'
2019/11/11 23:02:28 INFO     ▶ 0002 Initializing watcher...
Fetching https://goproxy.io/github.com/astaxie/beego/@v/list
Fetching https://goproxy.io/github.com/shiena/ansicolor/@v/list
go: finding github.com/shiena/ansicolor latest
Fetching https://goproxy.io/github.com/shiena/ansicolor/@latest
hello/controllers
hello/routers
hello
2019/11/11 23:02:36 SUCCESS  ▶ 0003 Built Successfully!
2019/11/11 23:02:36 INFO     ▶ 0004 Restarting 'hello'...
2019/11/11 23:02:36 SUCCESS  ▶ 0005 './hello' is running...
2019/11/11 23:02:36.876 [I] [asm_amd64.s:1337]  http server Running on http://:8080


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部