简体   繁体   中英

Go Dep - sync Gopkg.toml with vendor

Is there a way to create or sync Gokpkg.toml with the packages that i import in my .go files? If my Gopkg.toml is empty and I run dep ensure , it would download all the packages that I import in my code to the vendor folder but it won't update the Gopkg.toml file. It came up when I had to migrate a legacy project that didn't use a package manager to using dep in the simplest way possible by just creating a Gopkg.toml that contains the latest version of all the packages that I already import instead of running dep ensure -add ... manually for every package. Is there such command?

Remove your Gopkg.toml file and just run dep init and then dep ensure . It will create your Gopkg.toml file and automatically set all of the dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM