Story #11720

Add dependency management for Go packages

Added by Tom Clegg 4 months ago. Updated 4 months ago.

Status:ResolvedStart date:05/17/2017
Priority:NormalDue date:
Assignee:Tom Clegg% Done:

100%

Category:-
Target version:2017-05-24 sprint
Story points-Remaining (hours)0.00 hour
Velocity based estimate-

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.


Subtasks

Task #11723: ReviewResolvedNico César


Related issues

Related to Arvados - Bug #11717: vendor dir for crunch-run dependencies Closed

Associated revisions

Revision b22ff624
Added by Tom Clegg 4 months ago

Merge branch '11720-govendor'

closes #11720

History

#1 Updated by Tom Clegg 4 months 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

#2 Updated by Tom Clegg 4 months ago

  • Status changed from New to In Progress

#3 Updated by Tom Clegg 4 months ago

Procedure for updating dependencies:
  1. Ensure $GOPATH points somewhere (maybe ~/go)
  2. go get github.com/kardianos/govendor
  3. 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
  4. 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.

#5 Updated by Tom Clegg 4 months ago

  • Target version set to 2017-05-24 sprint

#6 Updated by Tom Clegg 4 months ago

  • Assignee set to Tom Clegg

#7 Updated by Tom Clegg 4 months ago

11720-govendor @ 865d1b22bb42a6c89ca9aa9a3513f3c61c6547c7 (missed adding vendor/.gitignore because it said to ignore itself)

#8 Updated by Nico César 4 months 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

#9 Updated by Tom Clegg 4 months 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)

#10 Updated by Nico César 4 months ago

besides that LGTM

#11 Updated by Tom Clegg 4 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:b22ff6242148a9b37baef6c74701fa85a8765adf.

Also available in: Atom PDF