beego 遇到的一些问题

1、安装 beego 出现的问题

今天在通过 go get -u github.com/astaxie/beego 安装 beego 应用时,出现下面问题:

# cd .; git clone https://github.com/astaxie/beego /home/go-plugin/src/github.com/astaxie/beego
Cloning into '/home/go-plugin/src/github.com/astaxie/beego'...
fatal: unable to access 'https://github.com/astaxie/beego/': Peer reports incompatible or unsupported protocol version.
package github.com/astaxie/beego: exit status 128

根据 Peer reports incompatible or unsupported protocol version 百度是说,git版本需要升级。我将git版本升级到最新,但是还是不行,通过下面命令解决了:

sudo yum update nss curl  # nss为名称解析和认证服务 curl为网络请求库

初步估计为nss相关的系统文件被修改了,重新更新之后有部分nss相关的配置文件被更新过。

看网上还有的人是报了这样的错误:

# cd .; git clonehttps://github.com/beego/bee e:\go\src\github.com\beego\bee
Cloning into'e:\go\src\github.com\beego\bee'...
fatal: unable to access 'https://github.com/beego/bee/': Could not resolve host:github.com
package github.com/beego/bee: exit status 128
Could not resolve host:github.com 看含义是无法访问 https 的 github,可能跟 git 的 ssl 验证有关,于是有下面的解决方法:
git config --global http.sslVerify false
go get github.com/beego/bee

这个是关闭 git 的 ssl 验证

 

2、bee run 无法热编译?

环境是通过docker搭建的,于是在编写 go 项目时也把项目文件映射在宿主主机上,即在本机上保留着真正的文件。问题来了,通过框架 beego 建立的项目,想用 bee run来进行热编译,但是无法通过,并报错:

 ERROR    ▶ 0006 Failed to build the application: go install test1: open test1: no such file or directory

百度了下,原因是我的编程环境是 linux,beego 需要使用和 linux 本机相同的文件系统,不能使用  win 共享的文件夹,挂载到 linux,不然 bee run就识别不到文件,也无法热编译。于是再建立了一个项目,不与 win 主机映射,就可以了,不过还是会抛出错误:

ERROR    ▶ 0019 Failed to open file on '/home/goinit/src/init1/controllers/default.go': open /home/goinit/src/init1/controllers/default.go: no such file or directory

这个可以忽略它。(这个我觉得是使用 docker 的原因,不是原生安装的 linux 系统)

转载于:https://www.cnblogs.com/linguoguo/p/8651442.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值