Idea #11720
closedAdd dependency management for Go packages
Description
Our Go packages (programs and libraries) need something analogous to bundler, so changes in our dependencies don't break our builds or introduce new code without giving us a chance to preview.
https://github.com/golang/go/wiki/PackageManagementTools
https://github.com/tools/godep seems like the most obvious choice.
https://github.com/kardianos/govendor might work.
Updated by Tom Clegg over 7 years ago
- Description updated (diff)
The first godep problem I ran into was discussed on github:
FWIW: Now that work has started for a native solution [...] I'm likely not going to be working on godep very much. In the interim I'm suggesting people migrate to govendor (https://github.com/kardianos/govendor) if they are having problems with godep.
So, with govendor:
11720-govendor @ f3c054cba1141f95b74c6143b1842364153c664b
Updated by Tom Clegg over 7 years ago
- Ensure
$GOPATH
points somewhere (maybe~/go
) go get github.com/kardianos/govendor
- Either
- add a symlink to a checked-out arvados tree:
mkdir -p ${GOPATH}/src/git.curoverse.com && ln -sfT ${WORKSPACE} ${GOPATH}/src/git.curoverse.com/arvados.git
- ...or check out the arvados tree the normal Go way:
go get git.curoverse.com/arvados.git
- add a symlink to a checked-out arvados tree:
cd ${GOPATH}/src/git.curoverse.com/arvados.git && ${GOPATH}/bin/govendor update +v
"+v" means all vendor packages. You can also update a single dependency, etc. See https://github.com/kardianos/govendor
Now $GOPATH/src/git.coroverse.com/arvados.git/vendor/vendor.json is updated with new version specs. Run tests, commit, push.
Updated by Tom Clegg over 7 years ago
11720-govendor @ b1b7a0be3c789795675e731c8c64bee3cb6d718c
example run https://ci.curoverse.com/job/developer-run-tests-remainder/297/console
Updated by Tom Clegg over 7 years ago
11720-govendor @ 865d1b22bb42a6c89ca9aa9a3513f3c61c6547c7 (missed adding vendor/.gitignore because it said to ignore itself)
Updated by Nico César over 7 years ago
in build/run-tests.sh
cd "$GOPATH/src/git.curoverse.com/arvados.git" && \ "$GOPATH/bin/govendor" sync -v || \ fatal "govendor sync failed"
shouldn't be using GOROOT ? I had the impression GOPATH is a colon/comma separated values of the path, that in 95% of the time is only onve value,
but I could be wrong and this changed in later versions of Go
Updated by Tom Clegg over 7 years ago
Nico César wrote:
shouldn't be using GOROOT ? I had the impression GOPATH is a colon/comma separated values of the path, that in 95% of the time is only onve value,
That's true in general, but in run-tests.sh we set GOPATH to {tempdir}/GOPATH so I don't think we need to support the multi-value case.
(GOROOT is where stdlib and the go tools themselves live)
Updated by Tom Clegg over 7 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:b22ff6242148a9b37baef6c74701fa85a8765adf.