@@ -24,15 +24,7 @@ const ensureShortHelp = `Ensure a dependency is safely vendored in the project`
24
24
const ensureLongHelp = `
25
25
Project spec:
26
26
27
- <path>[:alt source][@<constraint>]
28
-
29
- Flags:
30
-
31
- -update: update all, or only the named, dependencies in Gopkg.lock
32
- -add: add new dependencies
33
- -no-vendor: update Gopkg.lock if needed, but do not update vendor/
34
- -vendor-only: populate vendor/ without updating Gopkg.lock
35
- -dry-run: only report the changes that would be made
27
+ <import path>[:alt source URL][@<constraint>]
36
28
37
29
38
30
Ensure gets a project into a complete, reproducible, and likely compilable state:
@@ -54,8 +46,9 @@ combination of flags that are passed.
54
46
55
47
Examples:
56
48
57
- dep ensure Populate vendor from existing manifest and lock
58
- dep ensure github.com/pkg/foo@^1.0.1 Update a specific dependency to a specific version
49
+ dep ensure Populate vendor from existing Gopkg.toml and Gopkg.lock
50
+ dep ensure -add github.com/pkg/foo Introduce a named dependency at its newest version
51
+ dep ensure -add github.com/pkg/foo@^1.0.1 Introduce a named dependency with a particular constraint
59
52
60
53
For more detailed usage examples, see dep ensure -examples.
61
54
`
@@ -67,38 +60,52 @@ dep ensure
67
60
specified there. Otherwise, use the most recent version that can satisfy the
68
61
constraints in the manifest file.
69
62
70
- dep ensure -update
63
+ dep ensure -vendor-only
71
64
72
- Update all dependencies to the latest versions allowed by the manifest,
73
- ignoring any versions specified in the lock file. Update the lock file with
74
- any changes.
65
+ Write vendor/ from an exising Gopkg.lock file, without first verifying that
66
+ the lock is in sync with imports and Gopkg.toml. (This may be useful for
67
+ e.g. strategically layering a Docker images)
75
68
76
- dep ensure -update github.com/pkg/foo github.com/pkg/bar
69
+ dep ensure -add github.com/pkg/foo github.com/pkg/foo/bar
70
+
71
+ Introduce one or more dependencies, at their newest version, ensuring that
72
+ specific packages are present in Gopkg.lock and vendor/. Also, append a
73
+ corresponding constraint to Gopkg.toml.
74
+
75
+ Note: packages introduced in this way will disappear on the next "dep
76
+ ensure" if an import statement is not added first.
77
77
78
- Update a list of dependencies to the latest versions allowed by the manifest,
79
- ignoring any versions specified in the lock file. Update the lock file with
80
- any changes.
78
+ dep ensure -add github.com/pkg/foo/[email protected] bitbucket.org/pkg/bar/baz@master
81
79
82
- dep ensure github.com/pkg/foo@^1.0.1
80
+ Append version constraints to Gopkg.toml for one or more packages, if no
81
+ such rules already exist.
83
82
84
- Constrain pkg/foo to the latest release matching >= 1.0.1, < 2.0.0, and
85
- place that release in the vendor folder. If a constraint was previously set
86
- in the manifest, this resets it. This form of constraint strikes a good
87
- balance of safety and flexibility, and should be preferred for libraries .
83
+ If the named packages are not already imported, also ensure they are present
84
+ in Gopkg.lock and vendor/. As in the preceding example, packages introduced
85
+ in this way will disappear on the next "dep ensure" if an import statement
86
+ is not added first .
88
87
89
- dep ensure github.com/pkg/foo@~1.0.1
88
+ dep ensure -add github.com/pkg/foo:git.internal.com/alt/foo
90
89
91
- Same as above, but choose any release matching 1.0.x, preferring latest.
90
+ Specify an alternate location to treat as the upstream source for a dependency.
91
+
92
+ dep ensure -update github.com/pkg/foo github.com/pkg/bar
93
+
94
+ Update a list of dependencies to the latest versions allowed by Gopkg.toml,
95
+ ignoring any versions recorded in Gopkg.lock. Write the results to
96
+ Gopkg.lock and vendor/.
97
+
98
+ dep ensure -update
92
99
93
- dep ensure github.com/pkg/foo:git.internal.com/alt/foo
100
+ Update all dependencies to the latest versions allowed by Gopkg.toml,
101
+ ignoring any versions recorded in Gopkg.lock. Update the lock file with any
102
+ changes. (NOTE: Not recommended. Updating one/some dependencies at a time is
103
+ preferred.)
94
104
95
- Fetch the dependency from a different location.
105
+ dep ensure -update -no-vendor
96
106
97
- dep ensure -override github.com/pkg/foo@^1.0.1
107
+ As above, but only modify Gopkg.lock; leave vendor/ unchanged.
98
108
99
- Forcefully and transitively override any constraint for this dependency.
100
- Overrides are powerful, but harmful in the long term. They should be used as
101
- a last resort, especially if your project may be imported by others.
102
109
`
103
110
104
111
func (cmd * ensureCommand ) Name () string { return "ensure" }
0 commit comments