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

Commit e212ae6

Browse files
committed
Move version examples to Gopkg.toml doc
1 parent ab65bec commit e212ae6

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

FAQ.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Here are some suggestions for when you could use `dep` or `go get`:
8383
* Use `required` to explicitly add a dependency that is not imported directly or transitively, for example a development package used for code generation.
8484
* Use `ignored` to ignore a package and any of that package's unique dependencies.
8585

86+
Refer [Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md)
87+
for detailed definitions of the above terms.
88+
8689
## How do I constrain a transitive dependency's version?
8790
First, if you're wondering about this because you're trying to keep the version
8891
of the transitive dependency from changing, then you're working against `dep`'s
@@ -171,20 +174,8 @@ Only your project's directly imported dependencies are affected by a `constraint
171174
in the manifest. Transitive dependencies are unaffected.
172175

173176
Use an `override` entry for transitive dependencies.
174-
175-
By default, when you specify a version without an operator, such as `~` or `=`,
176-
`dep` automatically adds a caret operator, `^`. The caret operator pins the
177-
left-most non-zero digit in the version. For example:
178-
```
179-
^1.2.3 means 1.2.3 <= X < 2.0.0
180-
^0.2.3 means 0.2.3 <= X < 0.3.0
181-
^0.0.3 means 0.0.3 <= X < 0.1.0
182-
```
183-
184-
To pin a version of direct dependency in manifest, prefix the version with `=`.
185-
For example:
186177
```
187-
[[constraint]]
178+
[[override]]
188179
name = "github.com/pkg/errors"
189180
version = "=0.8.0"
190181
```

docs/Gopkg.toml.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,24 @@ version constraint of a specific dependency.
7979
Internally, dep uses [Masterminds/semver](https://github.com/Masterminds/semver)
8080
to work with semver versioning.
8181

82-
[Why is dep ignoreing a version constraint in the manifest?](https://github.com/golang/dep/blob/master/FAQ.md#why-is-dep-ignoring-a-version-constraint-in-the-manifest)
82+
`~` and `=` operators can be used with the versions. When a version is specified
83+
without any operator, `dep` automatically adds a caret operator, `^`. The caret
84+
operator pins the left-most non-zero digit in the version. For example:
85+
```
86+
^1.2.3 means 1.2.3 <= X < 2.0.0
87+
^0.2.3 means 0.2.3 <= X < 0.3.0
88+
^0.0.3 means 0.0.3 <= X < 0.1.0
89+
```
90+
91+
To pin a version of direct dependency in manifest, prefix the version with `=`.
92+
For example:
93+
```
94+
[[constraint]]
95+
name = "github.com/pkg/errors"
96+
version = "=0.8.0"
97+
```
8398

99+
[Why is dep ignoring a version constraint in the manifest?](https://github.com/golang/dep/blob/master/FAQ.md#why-is-dep-ignoring-a-version-constraint-in-the-manifest)
84100

85101
# Example
86102

0 commit comments

Comments
 (0)