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.conf
	create	 /home/liyongjun/mygo/src/hello/controllers/default.go
	create	 /home/liyongjun/mygo/src/hello/views/index.tpl
	create	 /home/liyongjun/mygo/src/hello/routers/router.go
	create	 /home/liyongjun/mygo/src/hello/tests/default_test.go
	create	 /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

你可能感兴趣的:(Go,Web)