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

cmd/dep: make out-of-sync ensure less strict #1225

Merged
merged 2 commits into from
Oct 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cmd/dep/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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...")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.


for i, arg := range args {
wg.Add(1)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"github.com/sdboyer/deptest"
"github.com/sdboyer/deptestdos"
"github.com/sdboyer/deptesttres"
)

func main() {
Expand All @@ -15,4 +16,6 @@ func main() {
deptest.Map["yo yo!"]
}
deptestdos.diMeLo("whatev")

type a deptesttres.Bar
}
2 changes: 2 additions & 0 deletions cmd/dep/testdata/harness_tests/ensure/add/desync/stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Fetching sources...
10 changes: 10 additions & 0 deletions cmd/dep/testdata/harness_tests/ensure/add/desync/testcase.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"commands": [
["ensure", "-update"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}

This file was deleted.

This file was deleted.

This file was deleted.