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

Commit f66513f

Browse files
scriptonistcarolynvs
authored andcommitted
Added two lost docs Testing changes to a dependency, Changing dependencies (#1677)
* Added two lost dependencies - Testing changes to a dependency, Changing dependencies
1 parent b2afe44 commit f66513f

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

docs/FAQ.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The FAQ predated the introduction of the rest of the documentation. If something
1212
## Configuration
1313
* [What is the difference between Gopkg.toml (the "manifest") and Gopkg.lock (the "lock")?](#what-is-the-difference-between-gopkgtoml-the-manifest-and-gopkglock-the-lock)
1414
* [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependency-s-version)
15+
* [How do I change the version of a dependecy?](#how-do-i-change-the-version-of-a-dependecy)
1516
* [Can I put the manifest and lock in the vendor directory?](#can-i-put-the-manifest-and-lock-in-the-vendor-directory)
1617
* [How do I get `dep` to authenticate to a `git` repo?](#how-do-i-get-dep-to-authenticate-to-a-git-repo)
1718
* [How do I get `dep` to consume private `git` repos using a Github Token?](#how-do-i-get-dep-to-consume-private-git-repos-using-a-github-token)
@@ -29,11 +30,12 @@ The FAQ predated the introduction of the rest of the documentation. If something
2930

3031
## Best Practices
3132
* [Should I commit my vendor directory?](#should-i-commit-my-vendor-directory)
33+
* [How do I test changes to a dependency?](#how-do-i-test-changes-to-a-dependency)
3234
* [How do I roll releases that `dep` will be able to use?](#how-do-i-roll-releases-that-dep-will-be-able-to-use)
3335
* [What semver version should I use?](#what-semver-version-should-i-use)
3436
* [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes-now)
3537
* [My dependers don't use `dep` yet. What should I do?](#my-dependers-don-t-use-dep-yet-what-should-i-do)
36-
* [How do I configure a dependency that doesn't tag its releases?](#how-do-i-configure-a-dependency-that-doesn-t-tag-its-releases)
38+
* [How do I configure a dependency that doesn't tag its release](#how-do-i-configure-a-dependency-that-doesn-t-tag-its-releases)
3739
* [How do I use `dep` with Docker?](#how-do-i-use-dep-with-docker)
3840
* [How do I use `dep` in CI?](#how-do-i-use-dep-in-ci)
3941

@@ -107,6 +109,21 @@ behave differently:
107109

108110
Overrides are also discussed with some visuals in [the gps docs](https://github.com/sdboyer/gps/wiki/gps-for-Implementors#overrides).
109111

112+
## How do I change the version of a dependecy
113+
114+
If you want to:
115+
116+
* Change the allowed `version`/`branch`/`revision`
117+
* Switch to using a fork
118+
119+
for one or more dependencies, do the following:
120+
121+
1. Manually edit your `Gopkg.toml`.
122+
1. Run
123+
124+
```sh
125+
$ dep ensure
126+
```
110127
## Can I put the manifest and lock in the vendor directory?
111128
No.
112129

@@ -350,6 +367,36 @@ It's up to you:
350367
- PR diffs will include changes for files under `vendor/` when Gopkg.lock is modified,
351368
however files in `vendor/` are [hidden by default](https://github.com/github/linguist/blob/v5.2.0/lib/linguist/generated.rb#L328) on Github.
352369
370+
## How do I test changes to a dependency?
371+
372+
Making changes in your `vendor/` directory directly is not recommended, as dep
373+
will overwrite any changes. Instead:
374+
375+
1. Delete the dependency from the `vendor/` directory.
376+
377+
```sh
378+
rm -rf vendor/<dependency>
379+
```
380+
381+
1. Add that dependency to your `GOPATH`, if it isn't already.
382+
383+
```sh
384+
$ go get <dependency>
385+
```
386+
387+
1. Modify the dependency in `$GOPATH/src/<dependency>`.
388+
1. Test, build, etc.
389+
390+
Don't run `dep ensure` until you're done. `dep ensure` will reinstall the
391+
dependency into `vendor/` based on your manifest, as if you were installing from
392+
scratch.
393+
394+
This solution works for short-term use, but for something long-term, take a look
395+
at [virtualgo](https://github.com/GetStream/vg).
396+
397+
To test out code that has been pushed as a new version, or to a branch or fork,
398+
see [changing dependencies](#how-do-i-change-change-the-version-of-a-dependecy).
399+
353400
## How do I roll releases that `dep` will be able to use?
354401

355402
In short: make sure you've committed your `Gopkg.toml` and `Gopkg.lock`, then

0 commit comments

Comments
 (0)