2.4 KiB
Dependency Management
dep
is a tool of choice when it comes to dependency management.
How we use dep
.
-
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 ofgo-ethereum
with SHAs inGopkg.toml
when importing a new version of upstream. (This is considered a bad practice fordep
but we are willing to take the risk to keep consitency with the upstream). -
Exclusive
status-go
dependencies. The policy there is to keep them as fresh as possible. Hence, no constraints for them in thetoml
file.
Installing dep
go get -u github.com/golang/dep/cmd/dep
Docs (worth reading)
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)
$ dep ensure -add github.com/foo/bar
- Commit changes.
Updating a dependency
(see: Changing a Dependency)
- Update constraint in the
Gopkg.toml
file if needed. - Run
dep ensure -update github.com/foo/bar
- Commit changes.
Updating all dependencies
dep ensure -update
Updating Geth
- Update
develop
branch instatus-im/go-ethereum
. - Update the
go-ethereum
dependency:dep ensure -v -update github.com/ethereum/go-ethereum
. - Make sure that
[[constraint]]
statements instatus-go/Gopkg.toml
contains the same SHAs asgo-ethereum/vendor/vendor.json
. - Update vendor files in
status-go
, runningdep ensure
. - Commit
Gopkg.lock
,Gopkg.toml
andvendor
directories.
Commiting changes
Make sure that you don't commit unnecessary changes to Gopkg.toml
and
Gopkg.lock
.
Common issues
- Relative imports and "Could not introduce package, as its subpackage does not contain usable Go code". See this comment for more information.