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

Update the FAQ to use constraint instead of dependencies (reflect #538) #739

Merged
merged 2 commits into from
Jun 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Summarize the question and quote the reply, linking back to the original comment
## When should I use `constraint`, `override`, `required`, or `ignored` in `Gopkg.toml`?

* Use `constraint` to constrain a [direct dependency](#what-is-a-direct-or-transitive-dependency) to a specific branch, version range, revision, or specify an alternate source such as a fork.
* Use `override` to constrain a [transitive dependency](#what-is-a-direct-or-transitive-dependency). See [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependencys-version) for more details on how overrides differ from dependencies. Overrides should be used cautiously, sparingly, and temporarily.
* Use `override` to constrain a [transitive dependency](#what-is-a-direct-or-transitive-dependency). See [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependencys-version) for more details on how overrides differ from constraints. Overrides should be used cautiously, sparingly, and temporarily.
* Use `required` to explicitly add a dependency that is not imported directly or transitively, for example a development package used for code generation.
* Use `ignored` to ignore a package and any of that package's unique dependencies.

Expand Down Expand Up @@ -88,7 +88,7 @@ Here are some suggestions for when you could use `dep` or `go get`:
Only your project's directly imported dependencies are affected by a `constraint` entry
in the manifest. Transitive dependencies are unaffected.

Use an `overrides` entry for transitive dependencies.
Use an `override` entry for transitive dependencies.

By default, when you specify a version without an operator, such as `~` or `=`,
`dep` automatically adds a caret operator, `^`. The caret operator pins the
Expand Down Expand Up @@ -122,10 +122,10 @@ dependency, you have a couple of options:
2. Use an override.

Overrides are a sledgehammer, and should only be used as a last resort. While
dependencies and overrides are declared in the same way in `Gopkg.toml`, they
constraints and overrides are declared in the same way in `Gopkg.toml`, they
behave differently:

* Dependencies:
* Constraints:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought of replacing "Dependencies" with "Constraints" around this section, but resisted thinking we might keep using "Dependencies" for direct dependencies as a reference to constraints.
👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in the context of explaining the diff between [constraint] and [override], I agree that it makes more sense to use the term Constraints.

1. Can be declared by any project's manifest, yours or a dependency
2. Apply only to direct dependencies of the project declaring the constraint
3. Must not conflict with the `constraint` entries declared in any other project's manifest
Expand Down