← 返回命令列表

Linux command

dep 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize dependency management

dep init

Add a dependency

dep ensure -add [github.com/pkg/errors]

Update all dependencies

dep ensure -update

Update specific dependency

dep ensure -update [github.com/pkg/errors]

Check dependency status

dep status

Visualize dependency tree

dep status -dot | dot -Tpng -o deps.png

说明

dep was the official dependency management tool for Go before Go modules became the standard. It manages project dependencies through Gopkg.toml and Gopkg.lock files, ensuring reproducible builds. The tool resolves transitive dependencies, handles version constraints, and vendors dependencies in the vendor directory. The ensure command is the primary interface for adding, updating, and synchronizing dependencies. dep uses semantic import versioning and supports various version constraint syntaxes including semver ranges, branches, and revisions.

参数

init
Initialize new project with dep.
ensure
Ensure dependencies are satisfied.
-add _PACKAGE_
Add a dependency.
-update _PACKAGE_
Update dependencies.
status
Show status of dependencies.
prune
Remove unused dependencies.
-v
Verbose output.
--help
Display help information.

FAQ

What is the dep command used for?

dep was the official dependency management tool for Go before Go modules became the standard. It manages project dependencies through Gopkg.toml and Gopkg.lock files, ensuring reproducible builds. The tool resolves transitive dependencies, handles version constraints, and vendors dependencies in the vendor directory. The ensure command is the primary interface for adding, updating, and synchronizing dependencies. dep uses semantic import versioning and supports various version constraint syntaxes including semver ranges, branches, and revisions.

How do I run a basic dep example?

Run `dep init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does init do in dep?

Initialize new project with dep.