From a9230be096c4d2632ed6393536923cacaffa42ae Mon Sep 17 00:00:00 2001 From: scriptonist Date: Mon, 12 Feb 2018 12:04:47 +0530 Subject: [PATCH 1/3] Added two lost dependencies - Testing changes to a dependency, Changing dependencies --- docs/FAQ.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/FAQ.md b/docs/FAQ.md index 92b5ee80aa..1523050ffb 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -12,6 +12,7 @@ The FAQ predated the introduction of the rest of the documentation. If something ## Configuration * [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) * [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependency-s-version) +* [How do I change change the version of a dependecy?](#how-do-i-change-change-the-version-of-a-dependecy) * [Can I put the manifest and lock in the vendor directory?](#can-i-put-the-manifest-and-lock-in-the-vendor-directory) * [How do I get `dep` to authenticate to a `git` repo?](#how-do-i-get-dep-to-authenticate-to-a-git-repo) * [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,6 +30,7 @@ The FAQ predated the introduction of the rest of the documentation. If something ## Best Practices * [Should I commit my vendor directory?](#should-i-commit-my-vendor-directory) +* [How do I test changes to a dependency?](#how-do-i-test-changes-to-a-dependency) * [How do I roll releases that `dep` will be able to use?](#how-do-i-roll-releases-that-dep-will-be-able-to-use) * [What semver version should I use?](#what-semver-version-should-i-use) * [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes-now) @@ -107,6 +109,21 @@ behave differently: Overrides are also discussed with some visuals in [the gps docs](https://github.com/sdboyer/gps/wiki/gps-for-Implementors#overrides). +## How do I change change the version of a dependecy + +If you want to: + +* Change the allowed `version`/`branch`/`revision` +* Switch to using a fork + +for one or more dependencies, do the following: + +1. Manually edit your `Gopkg.toml`. +1. Run + + ```sh + $ dep ensure + ``` ## Can I put the manifest and lock in the vendor directory? No. @@ -350,6 +367,36 @@ It's up to you: - PR diffs will include changes for files under `vendor/` when Gopkg.lock is modified, however files in `vendor/` are [hidden by default](https://github.com/github/linguist/blob/v5.2.0/lib/linguist/generated.rb#L328) on Github. +## How do I test changes to a dependency? + +Making changes in your `vendor/` directory directly is not recommended, as dep +will overwrite any changes. Instead: + +1. Delete the dependency from the `vendor/` directory. + + ```sh + rm -rf vendor/ + ``` + +1. Add that dependency to your `GOPATH`, if it isn't already. + + ```sh + $ go get + ``` + +1. Modify the dependency in `$GOPATH/src/`. +1. Test, build, etc. + +Don't run `dep ensure` until you're done. `dep ensure` will reinstall the +dependency into `vendor/` based on your manifest, as if you were installing from +scratch. + +This solution works for short-term use, but for something long-term, take a look +at [virtualgo](https://github.com/GetStream/vg). + +To test out code that has been pushed as a new version, or to a branch or fork, +see [changing dependencies](#how-do-i-change-change-the-version-of-a-dependecy). + ## How do I roll releases that `dep` will be able to use? In short: make sure you've committed your `Gopkg.toml` and `Gopkg.lock`, then From 50f3d4823df6a1aae18fbb002fd603c44cacdea0 Mon Sep 17 00:00:00 2001 From: scriptonist Date: Mon, 12 Feb 2018 20:02:26 +0530 Subject: [PATCH 2/3] Removed anchor tags --- docs/FAQ.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index 1523050ffb..e3c2869523 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -33,7 +33,7 @@ The FAQ predated the introduction of the rest of the documentation. If something * [How do I test changes to a dependency?](#how-do-i-test-changes-to-a-dependency) * [How do I roll releases that `dep` will be able to use?](#how-do-i-roll-releases-that-dep-will-be-able-to-use) * [What semver version should I use?](#what-semver-version-should-i-use) -* [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes-now) +* [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes -now) * [My dependers don't use `dep` yet. What should I do?](#my-dependers-don-t-use-dep-yet-what-should-i-do) * [How do I configure a dependency that doesn't tag its releases?](#how-do-i-configure-a-dependency-that-doesn-t-tag-its-releases) * [How do I use `dep` with Docker?](#how-do-i-use-dep-with-docker) @@ -109,7 +109,7 @@ behave differently: Overrides are also discussed with some visuals in [the gps docs](https://github.com/sdboyer/gps/wiki/gps-for-Implementors#overrides). -## How do I change change the version of a dependecy +## How do I change change the version of a dependecy If you want to: @@ -367,7 +367,7 @@ It's up to you: - PR diffs will include changes for files under `vendor/` when Gopkg.lock is modified, however files in `vendor/` are [hidden by default](https://github.com/github/linguist/blob/v5.2.0/lib/linguist/generated.rb#L328) on Github. -## How do I test changes to a dependency? +## How do I test changes to a dependency? Making changes in your `vendor/` directory directly is not recommended, as dep will overwrite any changes. Instead: From ce49425f9b1b20bd29446ec32d9fddc28022899c Mon Sep 17 00:00:00 2001 From: scriptonist Date: Mon, 12 Feb 2018 20:30:49 +0530 Subject: [PATCH 3/3] Fixed a typo --- docs/FAQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index e3c2869523..f998b162a5 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -12,7 +12,7 @@ The FAQ predated the introduction of the rest of the documentation. If something ## Configuration * [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) * [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependency-s-version) -* [How do I change change the version of a dependecy?](#how-do-i-change-change-the-version-of-a-dependecy) +* [How do I change the version of a dependecy?](#how-do-i-change-the-version-of-a-dependecy) * [Can I put the manifest and lock in the vendor directory?](#can-i-put-the-manifest-and-lock-in-the-vendor-directory) * [How do I get `dep` to authenticate to a `git` repo?](#how-do-i-get-dep-to-authenticate-to-a-git-repo) * [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) @@ -33,9 +33,9 @@ The FAQ predated the introduction of the rest of the documentation. If something * [How do I test changes to a dependency?](#how-do-i-test-changes-to-a-dependency) * [How do I roll releases that `dep` will be able to use?](#how-do-i-roll-releases-that-dep-will-be-able-to-use) * [What semver version should I use?](#what-semver-version-should-i-use) -* [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes -now) +* [Is it OK to make backwards-incompatible changes now?](#is-it-ok-to-make-backwards-incompatible-changes-now) * [My dependers don't use `dep` yet. What should I do?](#my-dependers-don-t-use-dep-yet-what-should-i-do) -* [How do I configure a dependency that doesn't tag its releases?](#how-do-i-configure-a-dependency-that-doesn-t-tag-its-releases) +* [How do I configure a dependency that doesn't tag its release](#how-do-i-configure-a-dependency-that-doesn-t-tag-its-releases) * [How do I use `dep` with Docker?](#how-do-i-use-dep-with-docker) * [How do I use `dep` in CI?](#how-do-i-use-dep-in-ci) @@ -109,7 +109,7 @@ behave differently: Overrides are also discussed with some visuals in [the gps docs](https://github.com/sdboyer/gps/wiki/gps-for-Implementors#overrides). -## How do I change change the version of a dependecy +## How do I change the version of a dependecy If you want to: