govendor

How do I migrate from Dep to Go Modules

不羁岁月 提交于 2019-11-30 19:04:33
I'm currently using Dep and would like to start using Go modules. How do I migrate? Migrating from Dep to Go Modules is very easy. Run go version and make sure you're using version 11 or later. Move your code outside of GOPATH or set export GO111MODULE=on . go mod init [module path] : This will import dependencies from Gopkg.lock. go mod tidy : This will remove unnecessary imports, and add indirect ones. rm -rf vendor/ : Optional step to delete your vendor folder. go build : Do a test build to see if it works. rm -f Gopkg.lock Gopkg.toml : Delete the obsolete files used for Dep. Go has

How do I migrate from Dep to Go Modules

↘锁芯ラ 提交于 2019-11-30 03:04:04
问题 I'm currently using Dep and would like to start using Go modules. How do I migrate? 回答1: Migrating from Dep to Go Modules is very easy. Run go version and make sure you're using version 11 or later. Move your code outside of GOPATH or set export GO111MODULE=on . go mod init [module path] : This will import dependencies from Gopkg.lock. go mod tidy : This will remove unnecessary imports, and add indirect ones. rm -rf vendor/ : Optional step to delete your vendor folder. go build : Do a test