You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
Assorted edits and wording tweaks, as well as including bash as type on
most of the fenced code blocks. Also relocated assets into docs/assets
from docs/img in order to accommodate docusaurus' expected layout.
@@ -15,9 +15,9 @@ For guides and reference materials about `dep`, see [the documentation](https://
15
15
16
16
## Installation
17
17
18
-
Unless you are hacking on dep, it is strongly recommended that you use a released version. You can grab the latest binary from the [releases](https://github.com/golang/dep/releases) page.
18
+
It is strongly recommended that you use a released version. Release binaries are available on the [releases](https://github.com/golang/dep/releases) page.
19
19
20
-
On macOS you can install or upgrade to the latest released version with Homebrew:
20
+
On MacOS you can install or upgrade to the latest released version with Homebrew:
Copy file name to clipboardExpand all lines: docs/FAQ.md
+2-13Lines changed: 2 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,8 @@
1
1
---
2
-
id: faq.md
3
-
---
4
-
5
-
6
-
7
2
title: FAQ
8
-
--
9
-
10
-
# FAQ
11
-
12
-
_The first rule of FAQ is don't bikeshed the FAQ, leave that for
13
-
[Create structure for managing docs](https://github.com/golang/dep/issues/331)._
3
+
---
14
4
15
-
Please contribute to the FAQ! Found an explanation in an issue or pull request helpful?
16
-
Summarize the question and quote the reply, linking back to the original comment.
5
+
The FAQ predated the introduction of the rest of the documentation. If something in here conflicts with other guides or reference documents, it's probably here that it's wrong - please file a PR!
Copy file name to clipboardExpand all lines: docs/daily-dep.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -41,22 +41,22 @@ Let's explore each of moments. To play along, you'll need to `cd` into a project
41
41
42
42
Let's say that we want to introduce a new dependency on `github.com/pkg/errors`. This can be accomplished with one command:
43
43
44
-
```
44
+
```bash
45
45
$ dep ensure -add github.com/pkg/errors
46
46
```
47
47
48
48
> Much like git, `dep status` and `dep ensure` can also be run from any subdirectory of your project root, which is determined by the presence of a `Gopkg.toml` file.
49
49
50
50
This should succeed, resulting in an updated `Gopkg.lock` and `vendor/` directory, as well as injecting a best-guess version constraint for `github.com/pkg/errors` into our `Gopkg.toml`. But, it will also report a warning:
51
51
52
-
```
52
+
```bash
53
53
"github.com/pkg/errors" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
54
54
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.
55
55
```
56
56
57
57
As the warning suggests, you should introduce an `import "github.com/pkg/errors"` in your code, the sooner the better. If you don't, a later `dep ensure` run will interpret your newly-added dependency as unused, and automatically remove it from `Gopkg.lock` and `vendor/`. This also means that if you want to add multiple dependencies at once, you'll need to do it in a single command, rather than one after the other:
58
58
59
-
```
59
+
```bash
60
60
$ dep ensure -add github.com/pkg/errors github.com/foo/bar
61
61
```
62
62
@@ -70,13 +70,13 @@ The [ensure mechanics section on `-add`](ensure-mechanics.md#add) has a more tho
70
70
71
71
Ideally, updating a dependency project to a newer version is a single command:
72
72
73
-
```
73
+
```bash
74
74
$ dep ensure -update github.com/foo/bar
75
75
```
76
76
77
77
This also works without arguments to try to update all dependencies, though it's generally not recommended:
Copy file name to clipboardExpand all lines: docs/deduction.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Import path deduction
2
+
title: Import Path Deduction
3
3
---
4
4
5
5
Deduction is dep's algorithm for looking at an import path and determining the portion of the path that corresponds to the source root. The algorithm has a static component, by which a small set of known, popular hosts like GitHub and Bitbucket have their roots deduced:
Copy file name to clipboardExpand all lines: docs/ensure-mechanics.md
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
title: Models and Mechanics
2
+
title: Models and Mechanisms
3
3
---
4
4
5
-
While dep has many discrete components and moving parts, all of these parts revolve around a central model. This document explains that model, then explores the major mechanisms of dep as they relate to it.
5
+
While dep has many discrete components and moving parts, all of these parts revolve around a central model. This document explains that model, then explores the dep's primary mechanisms in the context of that model.
6
6
7
7
## States and flows
8
8
@@ -17,7 +17,7 @@ Briefly, the four states are:
17
17
18
18
We can visually represent these four states as follows:
19
19
20
-

20
+

21
21
22
22
### Functional flow
23
23
@@ -28,7 +28,7 @@ It's useful to think of dep as a system that imposes a unidirectional, functiona
28
28
29
29
We can represent these two functions visually:
30
30
31
-

31
+

32
32
33
33
This is `dep ensure` - the typical flow, used when a `Gopkg.toml` already exists. When a project does not yet have a `Gopkg.toml`, `dep init` can generate one. The essential flow remains the same, but with changed inputs: instead of reading from an existing `Gopkg.toml` file, `dep init` constructs one out of data inferred from the user's GOPATH, and/or [a metadata file from another tool](). (In other words, `dep init` automatically migrates a project from other approaches to organizing dependencies.)
34
34
@@ -65,7 +65,7 @@ Each of `dep ensure`'s various flags affects the behavior of the solving and ven
65
65
66
66
These two flags are mutually exclusive, and determine which of `dep ensure`'s two functions are actually performed. Passing `-no-vendor` will cause only the solving function to be run, resulting in the creation of a new `Gopkg.lock`; `-vendor-only` will skip solving and run only the vendoring function, causing `vendor/` to be repopulated from the pre-existing `Gopkg.lock`.
67
67
68
-

68
+

69
69
70
70
Passing `-no-vendor` has the additional effect of causing the solving function to run unconditionally, bypassing the pre-check ordinarily made against `Gopkg.lock` to see if it already satisfies all inputs.
71
71
@@ -86,13 +86,13 @@ This implies two preconditions for `dep ensure -add`, at least one of which must
86
86
87
87
It is also possible to explicitly specify a version constraint:
When no version constraint is included in the argument, the solving function will select the latest version that works (generally, the newest semver release, or the default branch if there are no semver releases). Either this inferred version, or the specified version, will be appended into `Gopkg.toml`.
93
+
When no version constraint is included in the argument, the solving function will select the latest version that works (generally, the newest semver release, or the default branch if there are no semver releases). If solving succeeds, then either the argument-specified version, or if none then the version selected by the solver, will be appended into `Gopkg.toml`.
94
94
95
-
The behavioral variations that arise from the assorted differences in input and current project state are best expressed as a matrix:
95
+
The behavioral variations that arise from the assorted differences in input and current project state are best expressed as a matrix:
96
96
97
97
| Argument to `dep ensure -add`| Has `[[constraint]]` stanza in `Gopkg.toml`| In imports or `required`| Result |
@@ -105,15 +105,15 @@ The behavioral variations that arise from the assorted differences in input and
105
105
106
106
For any of the paths where `dep ensure -add` needs to run the solving function in order to generate an updated `Gopkg.lock`, the relevant information from CLI arguments is applied to the in-memory representation of `Gopkg.toml`:
107
107
108
-

108
+

109
109
110
110
Import path arguments that need to be added are injected via the `required` list, and if an explicit version requirement was specified, the equivalent of a `[[constraint]]` is created.
111
111
112
112
Though these rules may ultimately be persisted if solving succeeds, they are ephemeral at least until solving succeeds. And, from the solver's perspective, the ephemeral rules are indistinguishable from rules sourced directly from disk. Thus, to the solver, `dep ensure -add [email protected]` is identical to modifying `Gopkg.toml` by adding `"foo"` to the `required` list, plus a `[[constraint]]` stanza with `version = "v1.0.0"`, then running `dep ensure`.
113
113
114
114
However, because these modifications are ephemeral, a successful `dep ensure -add` may actually push the project out of sync. Constraint modifications generally do not, but if the `required` list is modified, then the project will desync. The user is warned accordingly:
115
115
116
-
```
116
+
```bash
117
117
$ dep ensure -add github.com/foo/bar
118
118
"github.com/foo/bar" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
119
119
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.
@@ -125,7 +125,7 @@ The behavior of `dep ensure -update` is intimately linked to the behavior of the
125
125
126
126
First, to solidify an implication in the discussion of [functional optimizations](#staying-in-sync), the solving function actually takes into account the pre-existing `Gopkg.lock` when it runs:
127
127
128
-

128
+

129
129
130
130
Injecting `Gopkg.lock` into the solver is a necessity. If we want the solver to preserve previously-selected versions by default, then the solver has to learn about the existing `Gopkg.lock` from somewhere. Otherwise, it wouldn't know what to preserve!
131
131
@@ -151,19 +151,19 @@ When a version hint from `Gopkg.lock` is not placed at the head of the version q
151
151
152
152
For example, say there is a project, `github.com/foo/bar`, with the following versions:
153
153
154
-
```
154
+
```bash
155
155
v1.2.0, v1.1.1, v1.1.0, v1.0.0, master
156
156
```
157
157
158
158
If we depend on that project with `^1.1.0`, and have `v1.1.0` in our `Gopkg.lock` , then it means there are three versions that match our constraint, and two of them are newer than the one currently selected. (There's also an older version, `v1.0.0`, and a `master` branch, but these aren't allowed by a `^1.1.0` constraint.) An ordinary `dep ensure` run will duplicate and push `v1.1.0` ahead of all the others in the queue:
159
159
160
-
```
160
+
```bash
161
161
[v1.1.0, v1.2.0, v1.1.1, v1.1.0, v1.0.0, master]
162
162
```
163
163
164
164
And `v1.1.0` will be selected again, unless some other condition is presented that forces the solver to discard it. When running `dep ensure -update github.com/foo/bar`, however, the locked version is not prepended:
165
165
166
-
```
166
+
```bash
167
167
[v1.2.0, v1.1.1, v1.1.0, v1.0.0, master]
168
168
```
169
169
@@ -175,15 +175,15 @@ Continuing with our example, it's important to note that updates with `-update`
175
175
176
176
It does work with branch constraints, which we can observe by including the underlying revision. If the user has constrained on `branch = "master"`, and `Gopkg.lock` points at a topologically older revision (say, `aabbccd`) than the tip of the canonical source's `master` branch (say, `bbccdde`), then `dep ensure` will end up contructing a queue that looks like this:
With `-update`, the hint at the head will be omitted; `branch = "master"` will cause the solver to reject all of the semantic versions, and finally settle on `master@bbccdde`.
183
183
184
184
All versions in the version queue keep track of an underlying revision, which means the same is true if, for example, some upstream project force-pushes a git tag:
Copy file name to clipboardExpand all lines: docs/failure-modes.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Failure Modes
3
3
---
4
4
5
-
Like all complex, network-oriented software, dep has known failure modes. These generally fall into two categories: I/O and logical. I/O errors arise from unexpected responses to system calls when dep is interacting with the network or local disk. Logical failures occur when dep encounters issues within the package management problem domain.
5
+
Like all complex, network-oriented software, dep has known failure modes. These generally fall into two categories: I/O and logical. I/O errors arise from unexpected responses to system calls that interact with the network or local disk. Logical failures occur when dep encounters issues within the package management problem domain.
6
6
7
7
## I/O errors
8
8
@@ -31,7 +31,7 @@ Network failures that you actually may observe are biased towards the earlier it
31
31
32
32
#### Persistent network failures
33
33
34
-
Although most network failures are ephemeral, there are three well-defined cases where that's not true. These are those cases, and their respective remediations:
34
+
Although most network failures are ephemeral, there are three well-defined cases where they're more permanent:
35
35
36
36
***The network on which the source resides is permanently unreachable from the user's location:** in practice, this generally means one of two things: you've forgotten to log into your company VPN, or you're behind [the GFW](https://en.wikipedia.org/wiki/Great_Firewall). In the latter case, setting the *de facto* standard HTTP proxy environment variables that [`http.ProxyFromEnvironment()`](https://golang.org/pkg/net/http/#ProxyFromEnvironment) respects will cause dep's `go-get` HTTP metadata requests, as well as git, bzr, and hg subcommands, to utilize the proxy.
37
37
@@ -102,7 +102,7 @@ Some of these failures can be as straightforward as typos, and are just as easil
102
102
103
103
Import path deduction, as detailed in the [deduction reference](deduction.md), has both static and dynamic phases. When neither of these phases is able to determine the source root for a given import path, it is considered to be a deduction failure. Deduction failures all have this key error text:
104
104
105
-
```
105
+
```bash
106
106
unable to deduce repository and sourcetypefor"<bad path>"...
107
107
```
108
108
@@ -168,7 +168,7 @@ For the most part, static ("is it one of the handful of hosts we know?") and dyn
168
168
169
169
When `dep ensure` or `dep init` exit with an error message looking something like this:
170
170
171
-
```
171
+
```bash
172
172
$ dep init
173
173
init failed: unable to solve the dependency graph: Solving failure: No versions of github.com/foo/bar met constraints:
174
174
v1.0.1: Could not introduce github.com/foo/[email protected], as its subpackage github.com/foo/bar/foo is missing. (Package is required by (root).)
@@ -181,7 +181,7 @@ _Note: all three of the other hard failure types can sometimes be reported as th
181
181
182
182
It means that the solver was unable to find a combination of versions for all dependencies that satisfy all the rules enforced by the solver. It is crucial to note that, just because dep provides a big list of reasons why each version failed _doesn't mean_ you have to address each one! That's just dep telling you why it ultimately couldn't use each of those versions in a solution.
183
183
184
-
These rules, and specific remediations for failing to meet them, are described in detail in the section on [solver invariants](the-solver.md#solving-invariants). This section is about the steps to take when solving failures occur in general. But, to set context, here's a quick summary:
184
+
These rules, and specific remediations for failing to meet them, are described in detail in the section on [solver invariants](the-solver.md#solving-invariants). This section is about the steps to take when solving failures occur in general. But, to set context, here's a summary:
185
185
186
186
***`[[constraint]]` conflicts:** when projects in the dependency graph disagree on what [versions](gopkg.toml.md#version-rules) are acceptable for a project, or where to [source](gopkg.toml.md#source) it from.
187
187
* Remediation will usually be either changing a `[[constraint]]` or adding an `[[override]]`, but genuine conflicts may require forking and hacking code.
0 commit comments