![cbc62c258f8b80d322abe771a1ca63f5.png](https://i-blog.csdnimg.cn/blog_migrate/6efb012be3c8737b1c784aa79f8800ef.jpeg)
一、创建一个 beego_env项目
mkdir beego_envcd beego_envgo mod init beego_env
二、替换 go.mod 内 的bee 源
fork github.com/beego/bee 到我自己的仓库 github.com/jinchunguang/bee
go.mod修改后的文件内容如下:
module beego_envreplace github.com/beego/bee v1.10.0 => github.com/jinchunguang/bee v1.12.1go 1.14
三、安装 beego 和 bee
go env -w GOPROXY=https://goproxy.cn,directgo get -u github.com/astaxie/beegogo get -u github.com/beego/bee
四、测试,我们在其他目录创建一个干净的项目 hello:
下面是我当前目录
$ pwd/d/SERVER
创建项目
bee new hello2020/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:SERVERhellogo.mod create D:SERVERhello create D:SERVERhelloconf create D:SERVERhellocontrollers create D:SERVERhellomodels create D:SERVERhelloouters create D:SERVERhelloests create D:SERVERhellostatic create D:SERVERhellostaticjs create D:SERVERhellostaticcss create D:SERVERhellostaticimg create D:SERVERhelloviews create D:SERVERhelloconfapp.conf create D:SERVERhellocontrollersdefault.go create D:SERVERhelloviewsindex.tpl create D:SERVERhellooutersouter.go create D:SERVERhelloestsdefault_test.go create D:SERVERhellomain.go2020/07/24 15:08:39 SUCCESS ▶ 0003 New application successfully created!
运行项目:
bee run______| ___ | |_/ / ___ ___| ___ / _ / _ | |_/ /| __/| __/____/ ___| ___| v1.11.02020/07/24 15:10:58 WARN ▶ 0001 Running application outside of GOPATH2020/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/ansicolorgo: found github.com/shiena/ansicolor in github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe966442020/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
访问项目
![70e12f6fde33a96db378737cc5c886a1.png](https://i-blog.csdnimg.cn/blog_migrate/d88230799a4e95e79e680357bb9477c7.jpeg)
image.png