安装Beego
安装Go之后,用以下命令安装或升级Beego:
go get -u github.com/astaxie/beego
go get -u github.com/beego/bee
安装过程一直卡在git的clone阶段:
~ go get -u github.com/astaxie/beego
# cd .; git clone https://github.com/astaxie/beego /xxxxxxx/GoProject/src/github.com/astaxie/beego
正克隆到 '/xxxxxxxx/GoProject/src/github.com/astaxie/beego'...
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: 远端意外挂断了
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
package github.com/astaxie/beego: exit status 128
官方教程给出的方案是关闭git
的https
验证:
git config --global http.sslVerify false
添加环境变量
参考传送门
这里注意的是,PATH路径要更改为:(更改后记得source使生效)
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
验证安装
命令行bee
能执行,即表示安装成功:
Bee is a Fast and Flexible tool for managing your Beego Web Application.
USAGE
bee command [arguments]
AVAILABLE COMMANDS
###
#
#
###
Use bee help [command] for more information about a command.
ADDITIONAL HELP TOPICS
建立第一个Beego项目
$ cd $GOPATH/src
$ bee new hello
$ cd hello
$ bee run
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
2019/06/16 14:55:04 INFO ▶ 0001 Using 'hello' as 'appname'
2019/06/16 14:55:04 INFO ▶ 0002 Initializing watcher...
2019/06/16 14:55:05 SUCCESS ▶ 0003 Built Successfully!
2019/06/16 14:55:05 INFO ▶ 0004 Restarting 'hello'...
2019/06/16 14:55:05 SUCCESS ▶ 0005 './hello' is running...
2019/06/16 14:55:05.962 [I] [asm_amd64.s:2337] http server Running on http://:8080
程序运行起来后,浏览器http://localhost:8080/
,见到小蜜蜂即代表运行成功!