搭建go语言web框架beego失败解决方法

1、这里默认大家已经搭建好了go语言的开发环境。
2、这里需要安装Beego源码和Bee开发工具,执行以下这两条命令:

 # go get -u -v github.com/astaxie/beego 
 # go get -u -v github.com/beego/bee

3、执行 go get -u -v github.com/astaxie/beego 命令时有失败,报错信息如下:

package google.golang.org/protobuf/encoding/prototext: unrecognized import path "google.golang.org/protobuf/encoding/prototext" (https fetch: Get https://google.golang.org/protobuf/encoding/prototext?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
package google.golang.org/protobuf/encoding/protowire: unrecognized import path "google.golang.org/protobuf/encoding/protowire" (https fetch: Get https://google.golang.org/protobuf/encoding/protowire?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
package google.golang.org/protobuf/proto: unrecognized import path "google.golang.org/protobuf/proto" (https fetch: Get https://google.golang.org/protobuf/proto?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
.................

大概是访问不了https://google.golang.org/protobuf/encoding/ 地址,解决方法如下:
在Go的"$GOPATH"目录下的src目录下,创建“google.golang.org/protobuf”文件夹:“src\google.golang.org\protobuf” 。

使用git clone命令,拉取 “https://github.com/protocolbuffers/protobuf-go.git” ,将下载的protobuf-go/文件夹下的内容复制到 创建的文件放到google.golang.org/protobuf目录下。
git 的protobuf-go目录下的文件复制到google.golang.org/protobuf 中:
在这里插入图片描述

在这里插入图片描述
执行 go get -u github.com/beego/bee 失败,拉取文件信息失败:

# github.com/gadelkareem/delve/service/rpccommon
G:\GoWorkspace\src\github.com\gadelkareem\delve\service\rpccommon\server.go:83:3: cannot use logger (type *"github.com/go-delve/delve/vendor/github.com/sirupsen/logrus".Entry) as type *"github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus".Entry in field value
# github.com/gadelkareem/delve/service/debugger
G:\GoWorkspace\src\github.com\gadelkareem\delve\service\debugger\debugger.go:129:3: cannot use logger (type *"github.com/go-delve/delve/vendor/github.com/sirupsen/logrus".Entry) as type *"github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus".Entry in field value

解决方法如下:
windows10下更改golang的配置:
set GO111MODULE=on
set GOPROXY=https://goproxy.io

再次执行"go get -u github.com/beego/bee "命令,成功了。
在$GOPATH/src下测试bee命令:
在这里插入图片描述
说明bee 工具安装成功。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值