golangのオフィシャル謹製パッケージマネージャ「dep」
個人プロジェクトではglideから乗り換えました。
install
公式の手順に則っておけば問題ないです。
Macでは brew
でインストール出来ます。
$ brew install dep
ディレクトリ構成
- $GOPATH - src/ - project/
depは $GOPATH/src
以下にプロジェクトのソースを管理するディレクトリを作成しておかないと動作しません。
使い方
$ cd $GOPATH/src/project $ dep init // Gopkg.tomlとGopkg.lockが作成されます。 // add $ dep ensure -add package-src-URL $ dep ensure
help
$ dep help dep is a tool for managing dependencies for Go projects Usage: dep <command> Commands: init Initialize a new project with manifest and lock files status Report the status of the project's dependencies ensure Ensure a dependency is safely vendored in the project prune Prune the vendor tree of unused packages version Show the dep version information Examples: dep init set up a new project dep ensure install the project's dependencies dep ensure -update update the locked versions of all dependencies dep ensure -add github.com/pkg/errors add a dependency to the project Use "dep help [command]" for more information about a command. //ensureのhelpの場合 $ dep help ensure Usage: dep ensure [-update | -add] [-no-vendor | -vendor-only] [-dry-run] [<spec>...] Project spec: <import path>[:alt source URL][@<constraint>] Ensure gets a project into a complete, reproducible, and likely compilable state: * All non-stdlib imports are fulfilled * All rules in Gopkg.toml are respected * Gopkg.lock records precise versions for all dependencies * vendor/ is populated according to Gopkg.lock Ensure has fast techniques to determine that some of these steps may be unnecessary. If that determination is made, ensure may skip some steps. Flags may be passed to bypass these checks; -vendor-only will allow an out-of-date Gopkg.lock to populate vendor/, and -no-vendor will update Gopkg.lock (if needed), but never touch vendor/. The effect of passing project spec arguments varies slightly depending on the combination of flags that are passed. Examples: dep ensure Populate vendor from existing Gopkg.toml and Gopkg.lock dep ensure -add github.com/pkg/foo Introduce a named dependency at its newest version dep ensure -add github.com/pkg/foo@^1.0.1 Introduce a named dependency with a particular constraint For more detailed usage examples, see dep ensure -examples. Flags: -add add new dependencies, or populate Gopkg.toml with constraints for existing dependencies (default: false) -dry-run only report the changes that would be made (default: false) -examples print detailed usage examples (default: false) -no-vendor update Gopkg.lock (if needed), but do not update vendor/ (default: false) -update update the named dependencies (or all, if none are named) in Gopkg.lock to the latest allowed by Gopkg.toml (default: false) -v enable verbose logging (default: false) -vendor-only populate vendor/ from Gopkg.lock without updating it first (default: false)
こんな感じ。オフィシャル謹製だし、今後はこちらを使っていこう。 refs: mattn.kaoriya.net