diff --git a/cmd/dep/ensure.go b/cmd/dep/ensure.go index 5fd76cde8c..a90c8da18d 100644 --- a/cmd/dep/ensure.go +++ b/cmd/dep/ensure.go @@ -340,9 +340,8 @@ func (cmd *ensureCommand) runUpdate(ctx *dep.Ctx, args []string, p *dep.Project, // user a bit, but the extra effort required is minimal, and it ensures the // user is isolating variables in the event of solve problems (was it the // "pending" changes, or the -update that caused the problem?). - // TODO(sdboyer) reduce this to a warning? if !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) { - 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) + ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName) } // 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 // user a bit, but the extra effort required is minimal, and it ensures the // user is isolating variables in the event of solve problems (was it the // "pending" changes, or the -add that caused the problem?). - // TODO(sdboyer) reduce this to a warning? if p.Lock != nil && !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) { - 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) + ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName) } rm, _ := params.RootPackageTree.ToReachMap(true, true, false, p.Manifest.IgnoredPackages()) @@ -479,7 +477,7 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm var wg sync.WaitGroup - fmt.Println("Fetching sources...") + ctx.Out.Println("Fetching sources...") for i, arg := range args { wg.Add(1) diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.lock similarity index 65% rename from cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.lock rename to cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.lock index 41dd2d4190..a9d0374ee3 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.lock @@ -3,19 +3,25 @@ [[projects]] name = "github.com/sdboyer/deptest" - version = "v0.8.0" - revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" packages = ["."] + revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" + version = "v1.0.0" [[projects]] name = "github.com/sdboyer/deptestdos" - version = "v2.0.0" + packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" + version = "v2.0.0" + +[[projects]] + branch = "master" + name = "github.com/sdboyer/deptesttres" packages = ["."] + revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" + inputs-digest = "86240895e0ee5788e7e8bb56e0d77afd58009a491b69f6835e546db9e5dacfcd" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.toml new file mode 100644 index 0000000000..57787fb45e --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.toml @@ -0,0 +1,6 @@ +[[constraint]] + name = "github.com/sdboyer/deptest" + version = "~0.8.0" +[[constraint]] + branch = "master" + name = "github.com/sdboyer/deptesttres" diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/main.go b/cmd/dep/testdata/harness_tests/ensure/add/desync/final/main.go similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/main.go rename to cmd/dep/testdata/harness_tests/ensure/add/desync/final/main.go diff --git a/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.lock new file mode 100644 index 0000000000..2d6f4c0278 --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.lock @@ -0,0 +1,15 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/sdboyer/deptesttres" + packages = ["."] + revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "9a7bd6944c26792ab2e97fed1227cc402f0cc00465016836efbf04239596dd9f" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.toml similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/Gopkg.toml rename to cmd/dep/testdata/harness_tests/ensure/add/desync/initial/Gopkg.toml diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/main.go b/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/main.go similarity index 85% rename from cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/main.go rename to cmd/dep/testdata/harness_tests/ensure/add/desync/initial/main.go index 2eae5b511d..7ad40aca5a 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/main.go +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/initial/main.go @@ -7,6 +7,7 @@ package main import ( "github.com/sdboyer/deptest" "github.com/sdboyer/deptestdos" + "github.com/sdboyer/deptesttres" ) func main() { @@ -15,4 +16,6 @@ func main() { deptest.Map["yo yo!"] } deptestdos.diMeLo("whatev") + + type a deptesttres.Bar } diff --git a/cmd/dep/testdata/harness_tests/ensure/add/desync/stdout.txt b/cmd/dep/testdata/harness_tests/ensure/add/desync/stdout.txt new file mode 100644 index 0000000000..c0d7219848 --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/stdout.txt @@ -0,0 +1,2 @@ +Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports. +Fetching sources... diff --git a/cmd/dep/testdata/harness_tests/ensure/add/desync/testcase.json b/cmd/dep/testdata/harness_tests/ensure/add/desync/testcase.json new file mode 100644 index 0000000000..eb95e6f16a --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/add/desync/testcase.json @@ -0,0 +1,10 @@ +{ + "commands": [ + ["ensure", "-add", "github.com/sdboyer/deptesttres@master"] + ], + "vendor-final": [ + "github.com/sdboyer/deptest", + "github.com/sdboyer/deptestdos", + "github.com/sdboyer/deptesttres" + ] +} diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/testcase.json b/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/testcase.json deleted file mode 100644 index 63801ab5df..0000000000 --- a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/testcase.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commands": [ - ["ensure", "-add", "foobar.com/baz"] - ], - "error-expected": "Gopkg.lock is out of sync with Gopkg.toml or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -add\"" -} diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.lock similarity index 85% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.lock rename to cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.lock index 41dd2d4190..1a7b1983f3 100644 --- a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.lock @@ -3,19 +3,19 @@ [[projects]] name = "github.com/sdboyer/deptest" - version = "v0.8.0" - revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" packages = ["."] + revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" + version = "v1.0.0" [[projects]] name = "github.com/sdboyer/deptestdos" - version = "v2.0.0" - revision = "5c607206be5decd28e6263ffffdcee067266015e" packages = ["."] + revision = "5c607206be5decd28e6263ffffdcee067266015e" + version = "v2.0.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" + inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.toml similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/Gopkg.toml rename to cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.toml diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/main.go b/cmd/dep/testdata/harness_tests/ensure/update/desync/final/main.go similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/initial/main.go rename to cmd/dep/testdata/harness_tests/ensure/update/desync/final/main.go diff --git a/cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/desync/initial/Gopkg.lock similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/add/errs/desync/final/Gopkg.lock rename to cmd/dep/testdata/harness_tests/ensure/update/desync/initial/Gopkg.lock diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/desync/initial/Gopkg.toml similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/Gopkg.toml rename to cmd/dep/testdata/harness_tests/ensure/update/desync/initial/Gopkg.toml diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/main.go b/cmd/dep/testdata/harness_tests/ensure/update/desync/initial/main.go similarity index 100% rename from cmd/dep/testdata/harness_tests/ensure/update/errs/desync/final/main.go rename to cmd/dep/testdata/harness_tests/ensure/update/desync/initial/main.go diff --git a/cmd/dep/testdata/harness_tests/ensure/update/desync/stdout.txt b/cmd/dep/testdata/harness_tests/ensure/update/desync/stdout.txt new file mode 100644 index 0000000000..9adb1974eb --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/update/desync/stdout.txt @@ -0,0 +1 @@ +Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports. diff --git a/cmd/dep/testdata/harness_tests/ensure/update/desync/testcase.json b/cmd/dep/testdata/harness_tests/ensure/update/desync/testcase.json new file mode 100644 index 0000000000..81a7c2320d --- /dev/null +++ b/cmd/dep/testdata/harness_tests/ensure/update/desync/testcase.json @@ -0,0 +1,9 @@ +{ + "commands": [ + ["ensure", "-update"] + ], + "vendor-final": [ + "github.com/sdboyer/deptest", + "github.com/sdboyer/deptestdos" + ] +} diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.lock deleted file mode 100644 index 41dd2d4190..0000000000 --- a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.lock +++ /dev/null @@ -1,21 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/sdboyer/deptest" - version = "v0.8.0" - revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" - packages = ["."] - -[[projects]] - name = "github.com/sdboyer/deptestdos" - version = "v2.0.0" - revision = "5c607206be5decd28e6263ffffdcee067266015e" - packages = ["."] - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "9b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.toml deleted file mode 100644 index 532da96a0d..0000000000 --- a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/initial/Gopkg.toml +++ /dev/null @@ -1,3 +0,0 @@ -[[constraint]] - name = "github.com/sdboyer/deptest" - version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/testcase.json b/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/testcase.json deleted file mode 100644 index 99304cff62..0000000000 --- a/cmd/dep/testdata/harness_tests/ensure/update/errs/desync/testcase.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commands": [ - ["ensure", "-update"] - ], - "error-expected": "Gopkg.lock is out of sync with Gopkg.toml or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -update\"" -}