搭建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语言web框架beego失败解决方法_第1张图片

搭建go语言web框架beego失败解决方法_第2张图片
执行 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命令:
搭建go语言web框架beego失败解决方法_第3张图片
说明bee 工具安装成功。

你可能感兴趣的:(golang)