一、创建一个 beego_env项目
mkdir beego_env
cd beego_env
go mod init beego_env
二、替换 go.mod 内 的bee 源
fork github.com/beego/bee
到我自己的仓库 github.com/jinchunguang/bee
go.mod
修改后的文件内容如下:
module beego_env
replace github.com/beego/bee v1.10.0 => github.com/jinchunguang/bee v1.12.1
go 1.14
三、安装 beego 和 bee
记得开启go mod
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go get -u github.com/astaxie/beego
go get -u github.com/beego/bee
四、测试,我们在其他目录创建一个干净的项目 hello:
下面是我当前目录
$ pwd
/d/SERVER
创建项目
bee new hello
2020/07/24 15:08:39 INFO ▶ 0001 generate new project support go modules.
2020/07/24 15:08:39 INFO ▶ 0002 Creating application...
create D:\SERVER\hello\go.mod
create D:\SERVER\hello\
create D:\SERVER\hello\conf\
create D:\SERVER\hello\controllers\
create D:\SERVER\hello\models\
create D:\SERVER\hello\routers\
create D:\SERVER\hello\tests\
create D:\SERVER\hello\static\
create D:\SERVER\hello\static\js\
create D:\SERVER\hello\static\css\
create D:\SERVER\hello\static\img\
create D:\SERVER\hello\views\
create D:\SERVER\hello\conf\app.conf
create D:\SERVER\hello\controllers\default.go
create D:\SERVER\hello\views\index.tpl
create D:\SERVER\hello\routers\router.go
create D:\SERVER\hello\tests\default_test.go
create D:\SERVER\hello\main.go
2020/07/24 15:08:39 SUCCESS ▶ 0003 New application successfully created!
运行项目:
bee run
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.11.0
2020/07/24 15:10:58 WARN ▶ 0001 Running application outside of GOPATH
2020/07/24 15:10:58 INFO ▶ 0002 Using 'hello' as 'appname'
2020/07/24 15:10:58 INFO ▶ 0003 Initializing watcher...
go: finding module for package github.com/shiena/ansicolor
go: found github.com/shiena/ansicolor in github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
2020/07/24 15:11:05 SUCCESS ▶ 0004 Built Successfully!
2020/07/24 15:11:05 INFO ▶ 0005 Restarting 'hello.exe'...
2020/07/24 15:11:05 SUCCESS ▶ 0006 './hello.exe' is running...
2020/07/24 15:11:05.347 [I] [asm_amd64.s:1373] http server Running on http://:8080
网友评论