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

ensure: implement -update flag #84

Merged
merged 2 commits into from
Jan 6, 2017
Merged
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
13 changes: 13 additions & 0 deletions ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ dep ensure
specified there. Otherwise, use the most recent version that can satisfy the
constraints in the manifest file.

dep ensure -update

Update all dependencies to the latest versions allowed by the manifest, ignoring
any versions specified in the lock file. Update the lock file with any
changes.

dep ensure github.com/pkg/foo@^1.0.1

Same as above, but choose any release >= 1.0.1, < 2.0.0. If a constraint was
Expand Down Expand Up @@ -95,6 +101,10 @@ func (cmd *ensureCommand) Run(args []string) error {
return nil
}

if cmd.update && len(args) > 0 {
return errors.New("Cannot pass -update and itemized project list (for now)")
}

p, err := depContext.loadProject("")
if err != nil {
return err
Expand Down Expand Up @@ -177,6 +187,9 @@ func (cmd *ensureCommand) Run(args []string) error {
}

params := p.makeParams()
// If -update was passed, we want the solver to allow all versions to change
params.ChangeAll = cmd.update

if *verbose {
params.Trace = true
params.TraceLogger = log.New(os.Stderr, "", 0)
Expand Down