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

Commit e0ec55d

Browse files
committed
docs: Add installation.md, lots of tweaks
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.
1 parent 7ae1fda commit e0ec55d

33 files changed

+96
-85
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><img src="docs/img/DigbyShadows.png" width="360"></p>
1+
<p align="center"><img src="docs/assets/DigbyShadows.png" width="360"></p>
22
<p align="center">
33
<a href="https://travis-ci.org/golang/dep"><img src="https://travis-ci.org/golang/dep.svg?branch=master" alt="Build Status"></img></a>
44
<a href="https://ci.appveyor.com/project/golang/dep"><img src="https://ci.appveyor.com/api/projects/status/github/golang/dep?svg=true&branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20failed&pendingText=Windows%20-%20pending" alt="Windows Build Status"></a>
@@ -15,9 +15,9 @@ For guides and reference materials about `dep`, see [the documentation](https://
1515

1616
## Installation
1717

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.
1919

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:
2121

2222
```sh
2323
$ brew install dep

docs/FAQ.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
---
2-
id: faq.md
3-
---
4-
5-
6-
72
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+
---
144

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!
176

187
## Concepts
198
* [Does `dep` replace `go get`?](#does-dep-replace-go-get)

docs/Gopkg.lock.md

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/assets/in-sync.png

34 KB
Loading
File renamed without changes.
File renamed without changes.

docs/day-to-day-dep.md renamed to docs/daily-dep.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ Let's explore each of moments. To play along, you'll need to `cd` into a project
4141

4242
Let's say that we want to introduce a new dependency on `github.com/pkg/errors`. This can be accomplished with one command:
4343

44-
```
44+
```bash
4545
$ dep ensure -add github.com/pkg/errors
4646
```
4747

4848
> 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.
4949
5050
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:
5151

52-
```
52+
```bash
5353
"github.com/pkg/errors" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
5454
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.
5555
```
5656

5757
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:
5858

59-
```
59+
```bash
6060
$ dep ensure -add github.com/pkg/errors github.com/foo/bar
6161
```
6262

@@ -70,13 +70,13 @@ The [ensure mechanics section on `-add`](ensure-mechanics.md#add) has a more tho
7070

7171
Ideally, updating a dependency project to a newer version is a single command:
7272

73-
```
73+
```bash
7474
$ dep ensure -update github.com/foo/bar
7575
```
7676

7777
This also works without arguments to try to update all dependencies, though it's generally not recommended:
7878

79-
```
79+
```bash
8080
$ dep ensure -update
8181
```
8282

docs/deduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Import path deduction
2+
title: Import Path Deduction
33
---
44

55
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:

docs/ensure-mechanics.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: Models and Mechanics
2+
title: Models and Mechanisms
33
---
44

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.
66

77
## States and flows
88

@@ -17,7 +17,7 @@ Briefly, the four states are:
1717

1818
We can visually represent these four states as follows:
1919

20-
![dep's four states](img/four-states.png)
20+
![dep's four states](assets/four-states.png)
2121

2222
### Functional flow
2323

@@ -28,7 +28,7 @@ It's useful to think of dep as a system that imposes a unidirectional, functiona
2828

2929
We can represent these two functions visually:
3030

31-
![dep's two main functions](img/annotated-func-arrows.png)
31+
![dep's two main functions](assets/annotated-func-arrows.png)
3232

3333
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.)
3434

@@ -65,7 +65,7 @@ Each of `dep ensure`'s various flags affects the behavior of the solving and ven
6565

6666
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`.
6767

68-
![Flags to run only one or the other of dep's functions](img/func-toggles.png)
68+
![Flags to run only one or the other of dep's functions](assets/func-toggles.png)
6969

7070
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.
7171

@@ -86,13 +86,13 @@ This implies two preconditions for `dep ensure -add`, at least one of which must
8686

8787
It is also possible to explicitly specify a version constraint:
8888

89-
```
89+
```bash
9090
$ dep ensure -add github.com/foo/[email protected]
9191
```
9292

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). 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`.
9494

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:
9696

9797
| Argument to `dep ensure -add` | Has `[[constraint]]` stanza in `Gopkg.toml` | In imports or `required` | Result |
9898
| ----------------------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- |
@@ -105,15 +105,15 @@ The behavioral variations that arise from the assorted differences in input and
105105

106106
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`:
107107

108-
![Model modifications made by -add](img/required-arrows.png)
108+
![Model modifications made by -add](assets/required-arrows.png)
109109

110110
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.
111111

112112
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`.
113113

114114
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:
115115

116-
```
116+
```bash
117117
$ dep ensure -add github.com/foo/bar
118118
"github.com/foo/bar" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
119119
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
125125

126126
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:
127127

128-
![Pre-existing lock feeds back into solving function](img/lock-back.png)
128+
![Pre-existing lock feeds back into solving function](assets/lock-back.png)
129129

130130
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!
131131

@@ -151,19 +151,19 @@ When a version hint from `Gopkg.lock` is not placed at the head of the version q
151151

152152
For example, say there is a project, `github.com/foo/bar`, with the following versions:
153153

154-
```
154+
```bash
155155
v1.2.0, v1.1.1, v1.1.0, v1.0.0, master
156156
```
157157

158158
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:
159159

160-
```
160+
```bash
161161
[v1.1.0, v1.2.0, v1.1.1, v1.1.0, v1.0.0, master]
162162
```
163163

164164
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:
165165

166-
```
166+
```bash
167167
[v1.2.0, v1.1.1, v1.1.0, v1.0.0, master]
168168
```
169169

@@ -175,15 +175,15 @@ Continuing with our example, it's important to note that updates with `-update`
175175

176176
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:
177177

178-
```
178+
```bash
179179
[master@aabbccd, v1.1.0, v1.2.0, v1.1.1, v1.1.0, v1.0.0, master@bbccdde]
180180
```
181181

182182
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`.
183183

184184
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:
185185

186-
```
186+
```bash
187187
[v1.1.0@aabbccd, v1.1.0, v1.2.0, v1.1.1, v1.1.0@bbccdde, v1.0.0, master]
188188
```
189189

docs/failure-modes.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Failure Modes
33
---
44

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.
66

77
## I/O errors
88

@@ -31,7 +31,7 @@ Network failures that you actually may observe are biased towards the earlier it
3131

3232
#### Persistent network failures
3333

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:
3535

3636
* **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.
3737

@@ -102,7 +102,7 @@ Some of these failures can be as straightforward as typos, and are just as easil
102102

103103
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:
104104

105-
```
105+
```bash
106106
unable to deduce repository and source type for "<bad path>"...
107107
```
108108

@@ -168,7 +168,7 @@ For the most part, static ("is it one of the handful of hosts we know?") and dyn
168168

169169
When `dep ensure` or `dep init` exit with an error message looking something like this:
170170

171-
```
171+
```bash
172172
$ dep init
173173
init failed: unable to solve the dependency graph: Solving failure: No versions of github.com/foo/bar met constraints:
174174
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
181181

182182
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.
183183

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:
185185

186186
* **`[[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.
187187
* Remediation will usually be either changing a `[[constraint]]` or adding an `[[override]]`, but genuine conflicts may require forking and hacking code.

0 commit comments

Comments
 (0)