Please use gopkg.in for importing mgo

roger peppe rogpeppe at gmail.com
Fri Aug 1 06:51:18 UTC 2014


On 1 August 2014 00:43, Menno Smits <menno.smits at canonical.com> wrote:
> Trunk is currently broken if building using a clean GOPATH because revision
> 03e56dcd was recently merged which imports mgo from labix.org instead of
> gopkg.in. We no longer use mgo from labix.org and godeps no longer installs
> it from that location.
>
> The following import paths should be used instead:
>
> gopkg.in/mgo.v2
> gopkg.in/mgo.v2/bson
> gopkg.in/mgo.v2/txn
>
> This was perhaps not publicised well enough but the switch was made a couple
> of weeks ago.
>
> Right now juju will only build on machines that incidentally have a
> labix.org mgo install. If the machine doesn't already have it, godeps won't
> install it and builds fail.
>
> I imagine the problem revision got past the landing bot because our test
> hosts still have the labix.org mgo installed. If so, this should be cleaned
> up.
>
> I will fix the problem imports in the upgrades package now.

I suggest that it might be a good thing to have a landing check
that checks for unwanted import duplication.

Something like:

    if godeps -t ./... | sed -r -e "s:\t.*::" \
       -e "s:labix\.org/v./mgo:gopkg.in/mgo.v0:" \
       -e "s:github\.com/juju/charm:gopkg.in/charm.v0:" \
       -e "s:(gopkg\.in/[^/]+)\.v[0-9]+:\1.vX:" | sort | uniq -d | grep '^'
    then
        echo imports with different versions found
        exit 1
    fi

might do the trick.



More information about the Juju-dev mailing list