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

Implement new spec for dep ensure #489

Merged
merged 39 commits into from Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
94fad51
Update some of docs and flags
sdboyer Apr 21, 2017
24a9b3b
Tweak usage text a bit
sdboyer Apr 30, 2017
2089f3e
Basic structure & implementation of default case
sdboyer Apr 30, 2017
817f06a
First bits of -update path
sdboyer Apr 30, 2017
5b03cbb
Fleshing out first pass of -update path
sdboyer Apr 30, 2017
d3a0679
First bits of -add path
sdboyer May 2, 2017
6f783e0
Further flesh out -add path
sdboyer May 9, 2017
a2dda19
Fix static problems
sdboyer May 10, 2017
1a54666
Catch up with package renames on master
sdboyer May 13, 2017
48e3fcf
Fix compile errors
sdboyer Jun 5, 2017
824716b
Catch up with master
sdboyer Jun 5, 2017
ca5a2fa
Reintroduce -dry-run flag
sdboyer Jun 5, 2017
d89de70
Move ensure flag validation into separate method
sdboyer Jun 5, 2017
7eea154
Failure case is when input hashes are NOT eq
sdboyer Jun 5, 2017
d341770
Fix several tests, usage output, * constraint use
sdboyer Jun 5, 2017
0577212
Remove ensure -override test cases
sdboyer Jun 5, 2017
8d42261
Hide output from glide importer tests
sdboyer Jun 5, 2017
9c05d37
Actually perform write in default ensure case
sdboyer Jun 5, 2017
8da156c
Remove tests of defunct ensure behavior
sdboyer Jun 12, 2017
424b7ff
Remove more unused code
sdboyer Jun 15, 2017
f4f7aba
Tests for ensure flag/arg validation
sdboyer Jun 15, 2017
6e855df
SafeWriter should not write out an unchanged lock
sdboyer Jun 17, 2017
8239b96
Add a swath of tests for ensure, ensure -update
sdboyer Jun 17, 2017
05b2e9f
Improve errors for many ensure failure modes
sdboyer Jun 18, 2017
cc04b58
Merge branch 'master' into new-ensure
sdboyer Jun 18, 2017
9b9f762
Add a handful of ensure -add test cases
sdboyer Jun 18, 2017
9707806
Split out getProjectConstraints, tweak errs, etc.
sdboyer Jun 19, 2017
61b8954
Several more ensure -add tests
sdboyer Jun 19, 2017
f38e02b
Add handling of feedback, etc. on ensure -add
sdboyer Jul 31, 2017
b461c3f
Merge branch 'master' into new-ensure
sdboyer Jul 31, 2017
97441d7
All tests passing
sdboyer Jul 31, 2017
9825b72
Create err subdirs for error cases
sdboyer Jul 31, 2017
686e331
Add a handful more harness tests
sdboyer Aug 1, 2017
943dede
Merge branch 'master' into new-ensure
sdboyer Aug 3, 2017
6af7093
Add -dry-run to usage output
sdboyer Aug 1, 2017
1cb2762
Fix up dep ensure -examples to match new interface
sdboyer Aug 2, 2017
42ef91d
Add file for general ensure tests
sdboyer Aug 3, 2017
7d21ee7
Add info msg ensure -v when first step is in sync
sdboyer Aug 3, 2017
b8f7027
Fix staticcheck errors, license
sdboyer Aug 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
595 changes: 496 additions & 99 deletions cmd/dep/ensure.go

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions cmd/dep/ensure_test.go
@@ -0,0 +1,51 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"testing"

"github.com/golang/dep/internal/gps"
)

func TestInvalidEnsureFlagCombinations(t *testing.T) {
ec := &ensureCommand{
update: true,
add: true,
}

if err := ec.validateFlags(); err == nil {
t.Error("-add and -update together should fail validation")
}

ec.vendorOnly, ec.add = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -update should fail validation")
}

ec.add, ec.update = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -add should fail validation")
}

ec.noVendor, ec.add = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -no-vendor should fail validation")
}
ec.noVendor = false

// Also verify that the plain ensure path takes no args. This is a shady
// test, as lots of other things COULD return errors, and we don't check
// anything other than the error being non-nil. For now, it works well
// because a panic will quickly result if the initial arg length validation
// checks are incorrectly handled.
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil {
t.Errorf("no args to plain ensure with -vendor-only")
}
ec.vendorOnly = false
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil {
t.Errorf("no args to plain ensure")
}
}

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

@@ -0,0 +1,8 @@

[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "0.8.1"
Expand Up @@ -5,8 +5,9 @@
package main

import (
_ "github.com/sdboyer/deptest"
"github.com/sdboyer/deptesttres"
)

func main() {
type a deptesttres.Bar
}
@@ -0,0 +1,10 @@
{
"commands": [
["init", "-no-examples"],
["ensure", "-add", "github.com/sdboyer/deptest", "github.com/sdboyer/deptest@v0.8.1"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
}

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

@@ -1,4 +1,4 @@

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "0.8.0"
version = "1.0.0"
Expand Up @@ -5,8 +5,9 @@
package main

import (
_ "github.com/sdboyer/deptest"
"github.com/sdboyer/deptest"
)

func main() {
type a deptest.Bar
}
@@ -0,0 +1,10 @@
{
"commands": [
["init", "-no-examples"],
["ensure", "-add", "github.com/sdboyer/deptesttres", "github.com/sdboyer/deptesttres/subp"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
}

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

@@ -0,0 +1,8 @@

[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "0.8.1"
Expand Up @@ -5,11 +5,9 @@
package main

import (
"fmt"

stuff "github.com/sdboyer/deptest"
"github.com/sdboyer/deptesttres"
)

func main() {
fmt.Println(stuff.Thing)
type a deptesttres.Bar
}
@@ -0,0 +1,10 @@
{
"commands": [
["init", "-no-examples"],
["ensure", "-add", "github.com/sdboyer/deptest@v0.8.1"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
}

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

@@ -0,0 +1,4 @@

[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/sdboyer/deptesttres"
)

func main() {
type a deptesttres.Bar
}
10 changes: 10 additions & 0 deletions cmd/dep/testdata/harness_tests/ensure/add/all-new/testcase.json
@@ -0,0 +1,10 @@
{
"commands": [
["init", "-no-examples"],
["ensure", "-add", "github.com/sdboyer/deptest"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
}

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

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

@@ -0,0 +1,18 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/sdboyer/deptest"
"github.com/sdboyer/deptestdos"
)

func main() {
err := nil
if err != nil {
deptest.Map["yo yo!"]
}
deptestdos.diMeLo("whatev")
}
@@ -0,0 +1,6 @@
{
"commands": [
["ensure", "-add", "foobar.com/baz"]
],
"error-expected": "Gopkg.toml and Gopkg.lock are out of sync. Run a plain dep ensure to resync them before attempting to -add"
}

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

@@ -0,0 +1,4 @@

[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/sdboyer/deptesttres"
)

func main() {
type a deptesttres.Bar
}
@@ -0,0 +1,10 @@
{
"commands": [
["init", "-no-examples"],
["ensure", "-add", "github.com/sdboyer/deptest@0.8.1", "github.com/sdboyer/deptest@1.0.0"]
],
"vendor-final": [
"github.com/sdboyer/deptesttres"
],
"error-expected": "can only specify rules once per project being added; rules were given at least twice for github.com/sdboyer/deptest"
}

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

@@ -0,0 +1,7 @@
[[constraint]]
name = "github.com/sdboyer/deptesttres"
branch = "master"

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "1.0.0"