go mod 安装bee 报错

报错信息

go: github.com/beego/bee imports
        github.com/beego/bee/cmd imports
        github.com/beego/bee/cmd/commands/dlv imports
        github.com/derekparker/delve/service: github.com/derekparker/delve@v1.4.0: parsing go.mod:
        module declares its path as: github.com/go-delve/delve
                but was required as: github.com/derekparker/delve

解决办法在 go.mod 内把 bee 的源替换掉,再执行安装命令

一、创建一个 go mod 下的文件夹

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   // 创建项目
cd src/hello    // 进入项目目录
go mod init hello
bee run // 大功告成

五、附上 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.11.1 // indirect        
    github.com/beego/bee v1.10.0 // indirect    
    github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 // indirect       
    github.com/casbin/casbin v1.8.2 // indirect 
    github.com/couchbase/go-couchbase v0.0.0-20190515160915-dcefcb68da4a // indirect    
    github.com/couchbase/gomemcached v0.0.0-20190515232915-c4b4ca0eb21d // indirect     
    github.com/couchbase/goutils v0.0.0-20190315194238-f9d42b11473b // indirect 
    github.com/edsrzf/mmap-go v1.0.0 // indirect        
    github.com/go-delve/delve v1.2.0 // indirect        
    github.com/go-redis/redis v6.15.2+incompatible // indirect  
    github.com/gogo/protobuf v1.2.1 // indirect 
    github.com/golang/protobuf v1.3.1 // indirect       
    github.com/golang/snappy v0.0.1 // indirect 
    github.com/gorilla/websocket v1.4.0 // indirect     
    github.com/kisielk/errcheck v1.2.0 // indirect      
    github.com/lib/pq v1.1.1 // indirect        
    github.com/onsi/ginkgo v1.8.0 // indirect   
    github.com/onsi/gomega v1.5.0 // indirect   
    github.com/pelletier/go-toml v1.4.0 // indirect     
    github.com/pkg/errors v0.8.1 // indirect    
    github.com/siddontang/ledisdb v0.0.0-20190202134119-8ceb77e66a92 // indirect        
    github.com/syndtr/goleveldb v1.0.0 // indirect      
    github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec // indirect     
    golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 // indirect  
    golang.org/x/net v0.0.0-20190603091049-60506f45cf65 // indirect     
    golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed // indirect     
    golang.org/x/text v0.3.2 // indirect        
    golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468 // indirect   
    gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)