2020完美解决最新beeGo2.0 go mod 下bee无法正常安装的问题

创建一个go mod 下的文件夹    其他技能:go启用了go.mod模式关闭方法(go env -w GO111MODULE=off)

mkdir test
cd test
go mod init test

在 go.mod 内把 bee 的源替换掉,如下所示:

github.com/realguan/bee 是我 fork 了 github.com/beego/bee 的源码,进行了源代码更改:

module test

replace github.com/beego/bee v1.10.0 => github.com/realguan/bee v1.12.1

go 1.12

开始正式安装 beego 和 bee

export GOPROXY=https://goproxy.io   // 科学上网安装
go get -u github.com/astaxie/beego
go get -u github.com/beego/bee

以上如果没报错,那就成功了。

接下来测试:

cd test
bee new hello   // 创建项目
go mod init hello
bee run // test目录内运行,大功告成

最后在浏览器运行:http://localhost:8080

 

go.mod安装完成后的样子

附上 go.mod :

module test

replace github.com/beego/bee v1.10.0 => github.com/realguan/bee v1.12.1

go 1.12

require (
	github.com/astaxie/beego v1.12.3 // indirect
	github.com/beego/bee v1.12.3 // indirect
	github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 // indirect
	github.com/lib/pq v1.8.0 // indirect
	github.com/magiconair/properties v1.8.4 // indirect
	github.com/mattn/go-colorable v0.1.8 // indirect
	github.com/mattn/go-runewidth v0.0.9 // indirect
	github.com/mitchellh/mapstructure v1.3.3 // indirect
	github.com/pelletier/go-toml v1.8.1 // indirect
	github.com/peterh/liner v1.2.0 // indirect
	github.com/prometheus/client_golang v1.8.0 // indirect
	github.com/prometheus/common v0.15.0 // indirect
	github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
	github.com/sirupsen/logrus v1.7.0 // indirect
	github.com/spf13/afero v1.4.1 // indirect
	github.com/spf13/cast v1.3.1 // indirect
	github.com/spf13/jwalterweatherman v1.1.0 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	github.com/spf13/viper v1.7.1 // indirect
	go.starlark.net v0.0.0-20201118183435-e55f603d8c79 // indirect
	golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff // indirect
	golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect
	golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
	golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
	golang.org/x/text v0.3.4 // indirect
	google.golang.org/protobuf v1.25.0 // indirect
	gopkg.in/ini.v1 v1.62.0 // indirect
)

 

 

 

你可能感兴趣的:(go,beego,go)