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

Commit 7bc57a4

Browse files
authored
Merge pull request #991 from sdboyer/update-readme
Bring README up to date after #489
2 parents e74b613 + 9beae3b commit 7bc57a4

13 files changed

+48
-20
lines changed

README.md

+42-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
# Dep
1+
<p align="center"><img src="docs/img/DigbyShadows.png" width="360"></p>
2+
<p align="center">
3+
<a href="https://travis-ci.org/golang/dep"><img src="https://travis-ci.org/golang/dep.svg?branch=master" alt="Build Status"></img></a>
4+
<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>
5+
<a href="https://codeclimate.com/github/golang/dep"><img src="https://codeclimate.com/github/golang/dep/badges/gpa.svg" alt="Code Climate"></img></a>
6+
<a href="https://codeclimate.com/github/golang/dep/coverage"><img src="https://codeclimate.com/github/golang/dep/badges/coverage.svg" /></a>
7+
</p>
28

3-
Linux: [![Build Status](https://travis-ci.org/golang/dep.svg?branch=master)](https://travis-ci.org/golang/dep) | Windows: [![Build status](https://ci.appveyor.com/api/projects/status/4pu2xnnrikol2gsf/branch/master?svg=true)](https://ci.appveyor.com/project/golang/dep/branch/master) | [![Code Climate](https://codeclimate.com/github/golang/dep/badges/gpa.svg)](https://codeclimate.com/github/golang/dep)
9+
## Dep
410

5-
Dep is a prototype dependency management tool. It requires Go 1.7 or newer to compile.
11+
`dep` is a prototype dependency management tool for Go. It requires Go 1.7 or newer to compile.
612

7-
`dep` is NOT an official tool. Yet. Check out the [Roadmap](https://github.com/golang/dep/wiki/Roadmap)!
13+
`dep` is the official _experiment_, but not yet the official tool. Check out the [Roadmap](https://github.com/golang/dep/wiki/Roadmap) for more on what this means!
814

915
## Current status
1016

1117
`dep` is safe for production use. That means two things:
1218

1319
* Any valid metadata file (`Gopkg.toml` and `Gopkg.lock`) will be readable and considered valid by any future version of `dep`.
20+
* The CLI UI is mostly stable. `dep init` and `dep ensure` are mostly set; `dep status` is likely to change a fair bit, and `dep prune` is [going to be absorbed into `dep ensure`](https://github.com/golang/dep/issues/944).
1421
* Generally speaking, it has comparable or fewer bugs than other tools out there.
1522

1623
That said, keep in mind the following:
1724

1825
* `dep` is still changing rapidly. If you need stability (e.g. for CI), it's best to rely on a released version, not tip.
19-
* [Some changes](https://github.com/golang/dep/pull/489) are pending to the CLI interface. Scripting on dep before they land is unwise.
2026
* `dep`'s exported API interface will continue to change in unpredictable, backwards-incompatible ways until we tag a v1.0.0 release.
2127

2228
## Context
@@ -44,7 +50,7 @@ $ brew install dep
4450
$ brew upgrade dep
4551
```
4652

47-
To start managing dependencies using dep, run the following from your project root directory:
53+
To start managing dependencies using dep, run the following from your project's root directory:
4854

4955
```sh
5056
$ dep init
@@ -63,10 +69,15 @@ This does the following:
6369

6470
## Usage
6571

66-
There is one main subcommand you will use: `dep ensure`. `ensure` first makes
67-
sure `Gopkg.lock` is consistent with your `import`s and `Gopkg.toml`. If any
68-
changes are detected, it then populates `vendor/` with exactly what's described
69-
in `Gopkg.lock`.
72+
There is one main subcommand you will use: `dep ensure`. `ensure` first checks that `Gopkg.lock` is consistent with `Gopkg.toml` and the `import`s in your code. If any
73+
changes are detected, `dep`'s solver works out a new `Gopkg.lock`. Then, `dep` checks if the contents of `vendor/` are what `Gopkg.lock` (the new one if applicable, else the existing one) says it should be, and rewrites `vendor/` as needed to bring it into line.
74+
75+
In essence, `dep ensure` [works in two phases to keep four buckets of state in sync](https://youtu.be/5LtMb090AZI?t=20m4s):
76+
77+
<img width="463" alt="states-flow" src="https://user-images.githubusercontent.com/21599/29223886-22dd2578-7e96-11e7-8b51-3637b9ddc715.png">
78+
79+
80+
_Note: until we ship [vendor verification](https://github.com/golang/dep/issues/121), we can't efficiently perform the `Gopkg.lock` <-> `vendor/` comparison, so `dep ensure` unconditionally regenerates all of `vendor/` to be safe._
7081

7182
`dep ensure` is safe to run early and often. See the help text for more detailed
7283
usage instructions.
@@ -91,12 +102,13 @@ matches the constraints from the manifest. If the dependency is missing from
91102

92103
### Adding a dependency
93104

94-
1. `import` the package in your `*.go` source code file(s).
95-
1. Run the following command to update your `Gopkg.lock` and populate `vendor/` with the new dependency.
105+
```sh
106+
$ dep ensure -add github.com/foo/bar
107+
```
96108

97-
```sh
98-
$ dep ensure
99-
```
109+
This adds a version constraint to your `Gopkg.toml`, and updates `Gopkg.lock` and `vendor/`. Now, import and use the package in your code! ✨
110+
111+
`dep ensure -add` has some subtle behavior variations depending on the project or package named, and the state of your tree. See `dep ensure -examples` for more information.
100112

101113
### Changing dependencies
102114

@@ -107,7 +119,7 @@ If you want to:
107119

108120
for one or more dependencies, do the following:
109121

110-
1. Modify your `Gopkg.toml`.
122+
1. Manually edit your `Gopkg.toml`.
111123
1. Run
112124

113125
```sh
@@ -126,7 +138,7 @@ github.com/Masterminds/vcs ^1.11.0 v1.11.1 3084677 3084
126138
github.com/armon/go-radix * branch master 4239b77 4239b77
127139
```
128140

129-
On top of that, if you have added new imports to your project or modified the manifest file without running `dep ensure` again, `dep status` will tell you there is a mismatch between the lock file and the current status of the project.
141+
On top of that, if you have added new imports to your project or modified `Gopkg.toml` without running `dep ensure` again, `dep status` will tell you there is a mismatch between `Gopkg.lock` and the current status of the project.
130142

131143
```sh
132144
$ dep status
@@ -142,23 +154,33 @@ As `dep status` suggests, run `dep ensure` to update your lockfile. Then run `de
142154

143155
### Updating dependencies
144156

145-
(to the latest version allowed by the manifest)
157+
Updating brings the version of a dependency in `Gopkg.lock` and `vendor/` to the latest version allowed by the constraints in `Gopkg.toml`.
158+
159+
You can update just a targeted subset of dependencies (recommended):
160+
161+
```sh
162+
$ dep ensure -update github.com/some/project github.com/other/project
163+
$ dep ensure -update github.com/another/project
164+
```
165+
166+
Or you can update all your dependencies at once:
146167

147168
```sh
148169
$ dep ensure -update
149170
```
150171

172+
"Latest" means different things depending on the type of constraint in use. If you're depending on a `branch`, `dep` will update to the latest tip of that branch. If you're depending on a `version` using [a semver range](#semantic-versioning), it will update to the latest version in that range.
173+
151174
### Removing dependencies
152175

153176
1. Remove the `import`s and all usage from your code.
177+
1. Remove `[[constraint]]` rules from `Gopkg.toml` (if any).
154178
1. Run
155179

156180
```sh
157181
$ dep ensure
158182
```
159183

160-
1. Remove from `Gopkg.toml`, if it was in there.
161-
162184
### Testing changes to a dependency
163185

164186
Making changes in your `vendor/` directory directly is not recommended, as dep

docs/img/DigbyFlat.png

385 KB
Loading

docs/img/DigbyFlat.svg

+1
Loading

docs/img/DigbyFlatScene2.png

538 KB
Loading

docs/img/DigbyFlatScene2.svg

+1
Loading

docs/img/DigbyScene2Flat.png

586 KB
Loading

docs/img/DigbyScene2Flat.svg

+1
Loading

docs/img/DigbyScene2Shadows.png

687 KB
Loading

docs/img/DigbyScene2Shadows.svg

+1
Loading

docs/img/DigbyShadows.png

445 KB
Loading

docs/img/DigbyShadows.svg

+1
Loading

docs/img/DigbyShadowsScene2.png

605 KB
Loading

docs/img/DigbyShadowsScene2.svg

+1
Loading

0 commit comments

Comments
 (0)