-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce the dependency vendoring tool: dep
.
#551
Merged
mandrigin
merged 2 commits into
status-im:develop
from
mandrigin:igorm/investigate-vendoring-tool-223-dep-geth173
Jan 25, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Dependency Management | ||
[`dep`](https://github.com/golang/dep) is a tool of choice when it comes to dependency management. | ||
|
||
## How we use `dep`. | ||
|
||
1. Transitive dependencies of `go-ethereum`. The most important thing for us is | ||
to be in-sync there. We want to reduce the regression scope. | ||
Hence, we pin down all the dependencies of `go-ethereum` with SHAs in `Gopkg.toml` when | ||
importing a new version of upstream. (This is considered a bad practice for | ||
`dep` but we are willing to take the risk to keep consitency with the upstream). | ||
|
||
2. Exclusive `status-go` dependencies. The policy there is to keep them as | ||
fresh as possible. Hence, no constraints for them in the `toml` file. | ||
|
||
## Installing `dep` | ||
|
||
`go get -u github.com/golang/dep/cmd/dep` | ||
|
||
|
||
## Docs (worth reading) | ||
1. [README](https://github.com/golang/dep/blob/master/README.md) | ||
2. [F.A.Q.](https://github.com/golang/dep/blob/master/docs/FAQ.md) | ||
|
||
|
||
## Checking-out all dependencies | ||
|
||
`dep ensure` - download all the dependencies based on `Gopkg.lock`. | ||
|
||
`Gopkg.lock` is kept inact if it is in-sync with `Gopkg.toml`. If the `toml` | ||
file is changed, `dep ensure` will re-generate `Gopkg.lock` as well. | ||
|
||
|
||
## Adding a new Dependency | ||
(see [Adding a new dependency](https://github.com/golang/dep#adding-a-dependency)) | ||
1. `$ dep ensure -add github.com/foo/bar` | ||
2. Commit changes. | ||
|
||
|
||
## Updating a dependency | ||
(see: [Changing a Dependency](https://github.com/golang/dep#changing-dependencies)) | ||
1. Update constraint in the `Gopkg.toml` file if needed. | ||
2. Run `dep ensure -update github.com/foo/bar` | ||
3. Commit changes. | ||
|
||
## Updating all dependencies | ||
|
||
`dep ensure -update` | ||
|
||
## Updating `Geth` | ||
|
||
1. Update `develop` branch in [`status-im/go-ethereum`](https://github.com/status-im/go-ethereum/tree/develop). | ||
2. Update the `go-ethereum` dependency: `dep ensure -v -update github.com/ethereum/go-ethereum`. | ||
3. Make sure that `[[constraint]]` statements in `status-go/Gopkg.toml` contains the same SHAs as `go-ethereum/vendor/vendor.json`. | ||
4. Update vendor files in `status-go`, running `dep ensure`. | ||
5. Commit `Gopkg.lock`, `Gopkg.toml` and `vendor` directories. | ||
|
||
|
||
## Commiting changes | ||
|
||
Make sure that you don't commit unnecessary changes to `Gopkg.toml` and | ||
`Gopkg.lock`. | ||
|
||
|
||
## Common issues | ||
|
||
1. Relative imports and "Could not introduce package, as its subpackage does not contain usable Go code". See [this comment](https://github.com/golang/dep/issues/899#issuecomment-317904001) for more information. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it worth noting how to install dependencies from scratch, e.g dep ensure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever get a repo state when you need to install all deps from scratch? (aka with empty
vendor
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess you are right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in the latest push