@@ -85,11 +85,29 @@ Here are some suggestions for when you could use `dep` or `go get`:
85
85
-[ @sdboyer in #376 ] ( https://github.com/golang/dep/issues/376#issuecomment-294045873 )
86
86
87
87
## Why is ` dep ` ignoring a version constraint in the manifest?
88
- Only your project's directly imported dependencies are affected by a ` dependencies ` entry
88
+ Only your project's directly imported dependencies are affected by a ` constraint ` entry
89
89
in the manifest. Transitive dependencies are unaffected.
90
90
91
91
Use an ` overrides ` entry for transitive dependencies.
92
92
93
+ By default, when you specify a version without an operator, such as ` ~ ` or ` = ` ,
94
+ ` dep ` automatically adds a caret operator, ` ^ ` . The caret operator pins the
95
+ left-most non-zero digit in the version. For example:
96
+ ```
97
+ ^1.2.3 means 1.2.3 <= X < 2.0.0
98
+ ^0.2.3 means 0.2.3 <= X < 0.3.0
99
+ ^0.0.3 means 0.0.3 <= X < 0.0.4
100
+ ```
101
+
102
+ To pin a version of direct dependency in manifest, prefix the version with ` = ` .
103
+ For example:
104
+ ```
105
+ [[constraint]]
106
+ name = "github.com/pkg/errors"
107
+ version = "=0.8.0"
108
+ ```
109
+
110
+
93
111
## How do I constrain a transitive dependency's version?
94
112
First, if you're wondering about this because you're trying to keep the version
95
113
of the transitive dependency from changing, then you're working against ` dep ` 's
@@ -110,7 +128,7 @@ behave differently:
110
128
* Dependencies:
111
129
1 . Can be declared by any project's manifest, yours or a dependency
112
130
2 . Apply only to direct dependencies of the project declaring the constraint
113
- 3 . Must not conflict with the ` dependencies ` declared in any other project's manifest
131
+ 3 . Must not conflict with the ` constraint ` entries declared in any other project's manifest
114
132
* Overrides:
115
133
1 . Are only utilized from the current/your project's manifest
116
134
2 . Apply globally, to direct and transitive dependencies
0 commit comments