Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 1cb2762

Browse files
committed
Fix up dep ensure -examples to match new interface
1 parent 6af7093 commit 1cb2762

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

cmd/dep/ensure.go

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,7 @@ const ensureShortHelp = `Ensure a dependency is safely vendored in the project`
2424
const ensureLongHelp = `
2525
Project spec:
2626
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>]
3628
3729
3830
Ensure gets a project into a complete, reproducible, and likely compilable state:
@@ -54,8 +46,9 @@ combination of flags that are passed.
5446
5547
Examples:
5648
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
5952
6053
For more detailed usage examples, see dep ensure -examples.
6154
`
@@ -67,38 +60,52 @@ dep ensure
6760
specified there. Otherwise, use the most recent version that can satisfy the
6861
constraints in the manifest file.
6962
70-
dep ensure -update
63+
dep ensure -vendor-only
7164
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)
7568
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.
7777
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
8179
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.
8382
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.
8887
89-
dep ensure github.com/pkg/foo@~1.0.1
88+
dep ensure -add github.com/pkg/foo:git.internal.com/alt/foo
9089
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
9299
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.)
94104
95-
Fetch the dependency from a different location.
105+
dep ensure -update -no-vendor
96106
97-
dep ensure -override github.com/pkg/foo@^1.0.1
107+
As above, but only modify Gopkg.lock; leave vendor/ unchanged.
98108
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.
102109
`
103110

104111
func (cmd *ensureCommand) Name() string { return "ensure" }

0 commit comments

Comments
 (0)