Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 7c62512

Browse files
committed
cmd/dep: make out-of-sync ensure less strict
1 parent 82b3908 commit 7c62512

File tree

21 files changed

+62
-49
lines changed

21 files changed

+62
-49
lines changed

cmd/dep/ensure.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,8 @@ func (cmd *ensureCommand) runUpdate(ctx *dep.Ctx, args []string, p *dep.Project,
340340
// user a bit, but the extra effort required is minimal, and it ensures the
341341
// user is isolating variables in the event of solve problems (was it the
342342
// "pending" changes, or the -update that caused the problem?).
343-
// TODO(sdboyer) reduce this to a warning?
344343
if !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) {
345-
return errors.Errorf("%s is out of sync with %s or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -update\"", dep.LockName, dep.ManifestName)
344+
ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName)
346345
}
347346

348347
// When -update is specified without args, allow every dependency to change
@@ -406,9 +405,8 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
406405
// user a bit, but the extra effort required is minimal, and it ensures the
407406
// user is isolating variables in the event of solve problems (was it the
408407
// "pending" changes, or the -add that caused the problem?).
409-
// TODO(sdboyer) reduce this to a warning?
410408
if p.Lock != nil && !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) {
411-
return errors.Errorf("%s is out of sync with %s or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -add\"", dep.LockName, dep.ManifestName)
409+
ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName)
412410
}
413411

414412
rm, _ := params.RootPackageTree.ToReachMap(true, true, false, p.Manifest.IgnoredPackages())

cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.lock renamed to cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.lock

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[[constraint]]
2+
name = "github.com/sdboyer/deptest"
3+
version = "~0.8.0"
4+
[[constraint]]
5+
branch = "master"
6+
name = "github.com/sdboyer/deptesttres"

cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/main.go renamed to cmd/dep/testdata/harness_tests/ensure/add/desync/initial/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77
import (
88
"github.com/sdboyer/deptest"
99
"github.com/sdboyer/deptestdos"
10+
"github.com/sdboyer/deptesttres"
1011
)
1112

1213
func main() {
@@ -15,4 +16,6 @@ func main() {
1516
deptest.Map["yo yo!"]
1617
}
1718
deptestdos.diMeLo("whatev")
19+
20+
type a deptesttres.Bar
1821
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"commands": [
3+
["ensure", "-add", "github.com/sdboyer/deptesttres@master"]
4+
],
5+
"vendor-final": [
6+
"github.com/sdboyer/deptest",
7+
"github.com/sdboyer/deptestdos",
8+
"github.com/sdboyer/deptesttres"
9+
]
10+
}

cmd/dep/testdata/harness_tests/ensure/add/errs/desync/testcase.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.lock renamed to cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"commands": [
3+
["ensure", "-update"]
4+
],
5+
"vendor-final": [
6+
"github.com/sdboyer/deptest",
7+
"github.com/sdboyer/deptestdos"
8+
]
9+
}

cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.lock

Lines changed: 0 additions & 21 deletions
This file was deleted.

cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

cmd/dep/testdata/harness_tests/ensure/update/errs/desync/testcase.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)