Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Last active July 25, 2024 03:38
Show Gist options
  • Save subfuzion/12342599e26f5094e4e2d08e9d4ad50d to your computer and use it in GitHub Desktop.
Save subfuzion/12342599e26f5094e4e2d08e9d4ad50d to your computer and use it in GitHub Desktop.

Revisions

  1. subfuzion revised this gist Aug 26, 2017. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -141,6 +141,21 @@ Go will first search your `vendor/` directory, then it will search your $GOPATH.
    If the package update has been pushed to its public repo, then simply run `dep ensure -update` as described in
    [Changing Dependencies](#changing-dependencies).

    ## Gopkg.toml

    While `dep init` will generate a `Gopkg.toml` file and `dep ensure -add` will add new dependencies to it, there are
    occasions where you will need to edit this file manually besides when removing a dependency. The format is straightforward
    and consists of the following elements:

    * `required`
    * `ignored`
    * `metadata` (under the root as well as under `constraint` and `override` declarations; ignored by dep)
    * `constraint`
    * `override`
    * `version` (a property of `constraint` and `override` declarations)

    There are important (and subtle) details involved, so it is best to read the [spec](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md) directly.

    ## Links

    [GitHub](https://github.com/golang/dep)
  2. subfuzion revised this gist Aug 26, 2017. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,25 @@
    ## Overview

    This gist is based on the information available at [golang/dep](https://github.com/golang/dep), only slightly more
    terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this
    information is helpful to anyone else as well.

    I initially advocated [Glide](https://glide.sh/) for my team and then, more recently, [vndr](https://github.com/LK4D4/vndr). I've also taken the approach of exerting direct control over what goes into `vendor/` in my Dockerfiles, and also work from
    isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under `vendor/`.

    At the end of the day, vendoring (and committing `vendor/`) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

    * automated ability to determine all of a project's dependencies
    * identify the latest version of a package that satisifies all dependencies in the dependency graph
    * ability to specify a range of acceptable versions of packages that satisfy the project's dependencies
    * ability to pin the range of acceptable versions to a set of explicit versions used for reproducible builds
    * ability to prune any unnecessary packages from the resulting vendor set

    Because it looks like dep is the [future](https://github.com/golang/dep/wiki/Roadmap) for Go vendoring, it makes sense
    to embrace dep now even though it is [still undergoing change](https://github.com/golang/dep#current-status) until it is
    merged into the toolchain and reaches a v1 release. As noted in the [roadmap](https://github.com/golang/dep/wiki/Roadmap),
    there is no "guarantee dep will be accepted"; yet, nevertheless, there appears to be a good deal of momentum behind dep
    at this point.

    ## Get (or update) dep

  3. subfuzion revised this gist Aug 25, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -66,6 +66,7 @@ are applied; for example:

    ```sh
    $ dep ensure -add github.com/foo/[email protected] github.com/foo/baz@master
    ```

    #### Checking status of dependencies

  4. subfuzion revised this gist Aug 25, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -42,8 +42,8 @@ $ dep ensure

    dep's *solver* regenerates `Gopkg.lock` if it detects any change in your code imports and/or `Gopkg.toml`. If this is
    the case, then the new `Gopkg.lock` file is used to completely rewrite `vendor/` (at some point
    [vednor verification](https://github.com/golang/dep/issues/121) will allow the contents of `vendor/` to also be
    checked for consistency with `Gopkg.lock`, updating only what is necessary to make the contents current.
    [vendor verification](https://github.com/golang/dep/issues/121) will allow the contents of `vendor/` to also be
    checked for consistency with `Gopkg.lock`, updating only what is necessary to make the contents current).

    #### Note

  5. subfuzion revised this gist Aug 24, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion dep.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ $ dep init

    #### Notes

    If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    If you are already using glide, godep, vndr, or govend, dep will convert the [existing dependency management file](https://github.com/golang/dep/blob/master/docs/FAQ.md#what-external-tools-are-supported).
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.

    @@ -122,6 +122,8 @@ If the package update has been pushed to its public repo, then simply run `dep e

    [GitHub](https://github.com/golang/dep)

    [Gopkg.toml format](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md)

    [FAQ](https://github.com/golang/dep/blob/master/docs/FAQ.md)

    [dep semver](https://github.com/golang/dep#semantic-versioning)
  6. subfuzion revised this gist Aug 24, 2017. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -69,24 +69,29 @@ $ dep ensure -add github.com/foo/[email protected] github.com/foo/baz@master

    #### Checking status of dependencies

    Use this to detect a mismatch between the state of your project, such as imports that have not been added (and therefore
    are not in the generated `Gopkg.lock` file). Use this information to update your configuration with `dep ensure -add`.
    > Use this to detect a mismatch between the configuration and state of your project

    One way this can happen is when you import a package that is resolved when you build because it is found
    in your `GOPATH`, but it has not been added to your configuration (and therefore is not present in the
    generated `Gopkg.lock` file).

    ```sh
    $ dep status
    ```

    Use this information to update your configuration with `dep ensure -add` as appropriate.

    #### Updating dependencies

    dep will update your dependencies to the latest versions that satisify the constraints specified in `Gopkg.toml`.
    > dep will update your dependencies to the latest versions that satisify the constraints specified in `Gopkg.toml`.

    Preferred:
    *Preferred*

    ```sh
    $ dep ensure -update github.com/foo/bar github.com/foo/baz...
    ```

    Possible, but being specific is preferred
    *Possible, but being specific is preferred*

    ```sh
    $ dep ensure -update
  7. subfuzion revised this gist Aug 24, 2017. 1 changed file with 20 additions and 5 deletions.
    25 changes: 20 additions & 5 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,9 @@ $ go get -u github.com/golang/dep/cmd/dep

    ## Initialize your project

    > dep will analyize your project, identify your dependencies, pick the highest compatible version for each dependency,
    > Run `dep init` to initialize your project.
    dep will analyize your project, identify your dependencies, pick the highest compatible version for each dependency,
    generate a [Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md) manifest and Gopkg.lock files
    (see [here](https://github.com/golang/dep/issues/119#issuecomment-275467269) for background on the two file format),
    and install dependencies in `vendor/`.
    @@ -32,6 +34,8 @@ a bit more detail.

    #### Installing dependencies

    > Run `dep ensure` to ensure `vendor/` is in the correct state for your configuration.
    ```sh
    $ dep ensure
    ```
    @@ -46,13 +50,22 @@ checked for consistency with `Gopkg.lock`, updating only what is necessary to ma
    This process may be slow for large projects, especially the first time as dependencies are cloned or when it hasn't been run in a while and there are many changesets to fetch. dep manages a cache at `$GOPATH/pkg/dep` to mitigate fetch overhead. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#why-is-dep-slow) for further details.

    There are a number of variations to this command. Run `dep ensure -examples` for details. One in particular to note
    that may be relevant when creating a Dockerfile is `dep ensure -vendor-only`.

    #### Adding a dependency

    > Use `dep ensure -add` to update your configuration with a new dependency.
    ```sh
    $ dep ensure -add github.com/foo/bar
    $ dep ensure -add github.com/foo/bar github.com/foo/baz...
    ```

    dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/`.
    dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/` to the latest version unless version constraints
    are applied; for example:

    ```sh
    $ dep ensure -add github.com/foo/[email protected] github.com/foo/baz@master

    #### Checking status of dependencies

    @@ -67,11 +80,13 @@ $ dep status

    dep will update your dependencies to the latest versions that satisify the constraints specified in `Gopkg.toml`.

    Preferred:

    ```sh
    $ dep ensure -update github.com/foo/bar github.com/another/project...
    $ dep ensure -update github.com/foo/bar github.com/foo/baz...
    ```

    or just
    Possible, but being specific is preferred

    ```sh
    $ dep ensure -update
  8. subfuzion revised this gist Aug 24, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,15 +18,15 @@ $ dep init

    #### Notes

    *If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.*
    for implementing configuration importers.

    *If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.*
    If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.

    *You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    See [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.*
    a bit more detail.

    ## Usage

  9. subfuzion revised this gist Aug 24, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ $ go get -u github.com/golang/dep/cmd/dep

    ## Initialize your project

    dep will analyize your project, identify your dependencies, pick the highest compatible version for each dependency,
    > dep will analyize your project, identify your dependencies, pick the highest compatible version for each dependency,
    generate a [Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md) manifest and Gopkg.lock files
    (see [here](https://github.com/golang/dep/issues/119#issuecomment-275467269) for background on the two file format),
    and install dependencies in `vendor/`.
  10. subfuzion revised this gist Aug 24, 2017. 1 changed file with 5 additions and 9 deletions.
    14 changes: 5 additions & 9 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,19 +18,15 @@ $ dep init

    #### Notes

    *
    If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    *If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    for implementing configuration importers.*

    *
    If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    *If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.*

    *
    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    *You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    See [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

    a bit more detail.*

    ## Usage

  11. subfuzion revised this gist Aug 24, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,16 +18,20 @@ $ dep init

    #### Notes

    *
    If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.

    *
    If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.

    *
    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    See [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.


    ## Usage

    #### Installing dependencies
  12. subfuzion revised this gist Aug 24, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -24,8 +24,8 @@ for implementing configuration importers.

    If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.

    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`.
    See [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

    ## Usage
  13. subfuzion revised this gist Aug 24, 2017. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -16,13 +16,15 @@ and install dependencies in `vendor/`.
    $ dep init
    ```

    Notes:
    #### Notes

    * If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    * If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    * You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See

    If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.

    You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

    @@ -39,7 +41,7 @@ the case, then the new `Gopkg.lock` file is used to completely rewrite `vendor/`
    [vednor verification](https://github.com/golang/dep/issues/121) will allow the contents of `vendor/` to also be
    checked for consistency with `Gopkg.lock`, updating only what is necessary to make the contents current.

    Note:
    #### Note

    This process may be slow for large projects, especially the first time as dependencies are cloned or when it hasn't been run in a while and there are many changesets to fetch. dep manages a cache at `$GOPATH/pkg/dep` to mitigate fetch overhead. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#why-is-dep-slow) for further details.
    @@ -75,7 +77,9 @@ or just
    $ dep ensure -update
    ```

    Note: the latest version means the latest version in a [semver range](https://github.com/golang/dep#semantic-versioning)
    #### Note

    The latest version means the latest version in a [semver range](https://github.com/golang/dep#semantic-versioning)
    or if depending on a branch, the tip of the branch.

    #### Removing dependencies
  14. subfuzion revised this gist Aug 24, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,11 +18,11 @@ $ dep init

    Notes:

    1. If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    * If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    3. You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    * If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    * You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

  15. subfuzion revised this gist Aug 24, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,11 +18,11 @@ $ dep init

    Notes:

    1. If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    1. If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    3. You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    3. You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

  16. subfuzion revised this gist Aug 24, 2017. 1 changed file with 22 additions and 10 deletions.
    32 changes: 22 additions & 10 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@

    ## Get (or update) dep

    $ go get -u github.com/golang/dep/cmd/dep
    ```sh
    $ go get -u github.com/golang/dep/cmd/dep
    ```

    ## Initialize your project

    @@ -10,7 +12,9 @@ generate a [Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.tom
    (see [here](https://github.com/golang/dep/issues/119#issuecomment-275467269) for background on the two file format),
    and install dependencies in `vendor/`.

    $ dep init
    ```sh
    $ dep init
    ```

    Notes:

    @@ -26,7 +30,9 @@ a bit more detail.

    #### Installing dependencies

    $ dep ensure
    ```sh
    $ dep ensure
    ```

    dep's *solver* regenerates `Gopkg.lock` if it detects any change in your code imports and/or `Gopkg.toml`. If this is
    the case, then the new `Gopkg.lock` file is used to completely rewrite `vendor/` (at some point
    @@ -40,7 +46,9 @@ This process may be slow for large projects, especially the first time as depend

    #### Adding a dependency

    $ dep ensure -add github.com/foo/bar
    ```sh
    $ dep ensure -add github.com/foo/bar
    ```

    dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/`.

    @@ -49,17 +57,23 @@ dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/`.
    Use this to detect a mismatch between the state of your project, such as imports that have not been added (and therefore
    are not in the generated `Gopkg.lock` file). Use this information to update your configuration with `dep ensure -add`.

    $ dep status
    ```sh
    $ dep status
    ```

    #### Updating dependencies

    dep will update your dependencies to the latest versions that satisify the constraints specified in `Gopkg.toml`.

    $ dep ensure -update github.com/foo/bar github.com/another/project...
    ```sh
    $ dep ensure -update github.com/foo/bar github.com/another/project...
    ```

    or just

    $ dep ensure -update
    ```sh
    $ dep ensure -update
    ```

    Note: the latest version means the latest version in a [semver range](https://github.com/golang/dep#semantic-versioning)
    or if depending on a branch, the tip of the branch.
    @@ -70,7 +84,7 @@ or if depending on a branch, the tip of the branch.
    2. Remove the relevant `[[constraint]]` rules from `Gopkg.toml`
    3. Run `dep ensure`

    ## Editing dependency packages
    ## Editing packages that are dependencies of your project

    Your project may rely on dependencies that you wish to edit. These dependencies should **not** be updated
    directly under `vendor/` since they can be overwritted by dep. Instead, volatile dependencies should be removed
    @@ -88,5 +102,3 @@ If the package update has been pushed to its public repo, then simply run `dep e

    [dep semver](https://github.com/golang/dep#semantic-versioning)



  17. subfuzion revised this gist Aug 24, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dep.md
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ manually from under `vendor/` and then placed in the appropriate location in you
    Go will first search your `vendor/` directory, then it will search your $GOPATH.

    If the package update has been pushed to its public repo, then simply run `dep ensure -update` as described in
    (Changing Dependencies)[#changing-dependencies].
    [Changing Dependencies](#changing-dependencies).

    ## Links

  18. subfuzion revised this gist Aug 24, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dep.md
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ manually from under `vendor/` and then placed in the appropriate location in you
    Go will first search your `vendor/` directory, then it will search your $GOPATH.

    If the package update has been pushed to its public repo, then simply run `dep ensure -update` as described in
    [[#changing-dependencies]].
    (Changing Dependencies)[#changing-dependencies].

    ## Links

  19. subfuzion revised this gist Aug 24, 2017. 1 changed file with 39 additions and 1 deletion.
    40 changes: 39 additions & 1 deletion dep.md
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ a bit more detail.

    ## Usage

    #### Installing / updating dependencies
    #### Installing dependencies

    $ dep ensure

    @@ -44,11 +44,49 @@ This process may be slow for large projects, especially the first time as depend

    dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/`.

    #### Checking status of dependencies

    Use this to detect a mismatch between the state of your project, such as imports that have not been added (and therefore
    are not in the generated `Gopkg.lock` file). Use this information to update your configuration with `dep ensure -add`.

    $ dep status

    #### Updating dependencies

    dep will update your dependencies to the latest versions that satisify the constraints specified in `Gopkg.toml`.

    $ dep ensure -update github.com/foo/bar github.com/another/project...

    or just

    $ dep ensure -update

    Note: the latest version means the latest version in a [semver range](https://github.com/golang/dep#semantic-versioning)
    or if depending on a branch, the tip of the branch.

    #### Removing dependencies

    1. Remove the relevant `import` package statements and usage in your code
    2. Remove the relevant `[[constraint]]` rules from `Gopkg.toml`
    3. Run `dep ensure`

    ## Editing dependency packages

    Your project may rely on dependencies that you wish to edit. These dependencies should **not** be updated
    directly under `vendor/` since they can be overwritted by dep. Instead, volatile dependencies should be removed
    manually from under `vendor/` and then placed in the appropriate location in your $GOPATH. When building,
    Go will first search your `vendor/` directory, then it will search your $GOPATH.

    If the package update has been pushed to its public repo, then simply run `dep ensure -update` as described in
    [[#changing-dependencies]].

    ## Links

    [GitHub](https://github.com/golang/dep)

    [FAQ](https://github.com/golang/dep/blob/master/docs/FAQ.md)

    [dep semver](https://github.com/golang/dep#semantic-versioning)



  20. subfuzion revised this gist Aug 24, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,9 @@ Notes:
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.
    3. You can tell dep to resolve dependencies from `GOPATH` before resorting to network mode with `dep init -gopath`. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-make-dep-resolve-dependencies-from-my-gopath) for
    a bit more detail.

    ## Usage

  21. subfuzion revised this gist Aug 24, 2017. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -21,13 +21,26 @@ for implementing configuration importers.

    ## Usage

    #### Installing / updating dependencies

    $ dep ensure

    dep's *solver* regenerates `Gopkg.lock` if it detects any change in your code imports and/or `Gopkg.toml`. If this is
    the case, then the new `Gopkg.lock` file is used to completely rewrite `vendor/` (at some point
    [vednor verification](https://github.com/golang/dep/issues/121) will allow the contents of `vendor/` to also be
    checked for consistency with `Gopkg.lock`, updating only what is necessary to make the contents current.

    Note:

    This process may be slow for large projects, especially the first time as dependencies are cloned or when it hasn't been run in a while and there are many changesets to fetch. dep manages a cache at `$GOPATH/pkg/dep` to mitigate fetch overhead. See
    [here](https://github.com/golang/dep/blob/master/docs/FAQ.md#why-is-dep-slow) for further details.

    #### Adding a dependency

    $ dep ensure -add github.com/foo/bar

    dep will update your `Gopkg.toml`, `Gopkg.lock`, and `vendor/`.

    ## Links

    [GitHub](https://github.com/golang/dep)
  22. subfuzion revised this gist Aug 24, 2017. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -18,3 +18,21 @@ Notes:
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.

    ## Usage

    $ dep ensure

    dep's *solver* regenerates `Gopkg.lock` if it detects any change in your code imports and/or `Gopkg.toml`. If this is
    the case, then the new `Gopkg.lock` file is used to completely rewrite `vendor/` (at some point
    [vednor verification](https://github.com/golang/dep/issues/121) will allow the contents of `vendor/` to also be
    checked for consistency with `Gopkg.lock`, updating only what is necessary to make the contents current.

    ## Links

    [GitHub](https://github.com/golang/dep)

    [FAQ](https://github.com/golang/dep/blob/master/docs/FAQ.md)



  23. subfuzion created this gist Aug 24, 2017.
    20 changes: 20 additions & 0 deletions dep.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@

    ## Get (or update) dep

    $ go get -u github.com/golang/dep/cmd/dep

    ## Initialize your project

    dep will analyize your project, identify your dependencies, pick the highest compatible version for each dependency,
    generate a [Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md) manifest and Gopkg.lock files
    (see [here](https://github.com/golang/dep/issues/119#issuecomment-275467269) for background on the two file format),
    and install dependencies in `vendor/`.

    $ dep init

    Notes:

    1. If you are already using glide, godep, vndr, or govend, dep will convert the existing dependency management file.
    See this [issue](https://github.com/golang/dep/issues/186) and this [interface](https://github.com/golang/dep/blob/074cec3e7ff795efa421f57db333c4328402f01c/cmd/dep/root_analyzer.go#L20)
    for implementing configuration importers.
    2. If you have an existing `vendor/` directory, it will be backed up to `_vendor-TIMESTAMP/`.