macOS安装Beego

安装 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

官方教程给出的方案是关闭githttps验证:

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/,见到小蜜蜂即代表运行成功!
屏幕快照 2019-06-16 下午 2.57.56.png

本文链接:https://ariser.cn/index.php/archives/129/
本站文章采用 知识共享署名4.0 国际许可协议进行许可,请在转载时注明出处及本声明!