ensure: Make -no-vendor combined with -dry-run fail when Gopkg.lock is outdated

This commit is contained in:
Jelte Fennema 2017-10-10 11:02:08 -06:00
Родитель d10af5e1de
Коммит 00e6a2338f
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -110,6 +110,12 @@ dep ensure -update -no-vendor
As above, but only modify Gopkg.lock; leave vendor/ unchanged.
dep ensure -no-vendor -dry-run
This fails with a non zero exit code if Gopkg.lock is not up to date with
the Gopkg.toml or the project imports. It can be useful to run this during
CI to check if Gopkg.lock is up to date.
`
var (
@ -267,6 +273,10 @@ func (cmd *ensureCommand) runDefault(ctx *dep.Ctx, args []string, p *dep.Project
return errors.WithMessage(sw.Write(p.AbsRoot, sm, true, logger), "grouped write of manifest, lock and vendor")
}
if cmd.noVendor && cmd.dryRun {
return errors.New("Gopkg.lock was not up to date")
}
solution, err := solver.Solve()
if err != nil {
handleAllTheFailuresOfTheWorld(err)