首先市面上大多數人都是用godep,原因是這個出來得比較早。
godep已經不再維護了,可以在github上看到以下聲明:
Godep - Archived
Please use dep or another tool instead.
Godep will continue to be supported for some time but is considered to be in a state of support rather than active feature development.
dep是官方使用的,godep是第三方的。
dep的使用:
go get -u github.com/golang/dep/cmd/dep
在go工程目錄下:
創建新項目:
cd $GOPATH/src 即為 cd /golang/src
dep init app
就會生成Gopkg.lock, Gopkg.toml vendor/
或者 在已有項目下
cd /golang/src/game_server
dep init
也會生成3個文件:Gopkg.lock, Gopkg.toml vendor/
假如我在Gopkg.toml里面增刪改了某些庫,只需要執行
dep ensure
就是最新的了