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

Commit 4b954d7

Browse files
committed
Merge branch 'govendor-importer' of github.com:kyleconroy/dep into govendor-importer
2 parents be14ae0 + 8378018 commit 4b954d7

File tree

8 files changed

+123
-0
lines changed

8 files changed

+123
-0
lines changed

cmd/dep/govendor_importer_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bytes"
99
"log"
1010
"path/filepath"
11+
"strings"
1112
"testing"
1213

1314
"github.com/golang/dep/internal/gps"
@@ -190,6 +191,37 @@ func TestGovendorConfig_Convert_TestProject(t *testing.T) {
190191
}
191192
}
192193

194+
func TestGovendorConfig_Convert_Ignore(t *testing.T) {
195+
h := test.NewHelper(t)
196+
defer h.Cleanup()
197+
198+
ctx := newTestContext(h)
199+
sm, err := ctx.SourceManager()
200+
h.Must(err)
201+
defer sm.Release()
202+
203+
pkg := "github.com/sdboyer/deptest"
204+
205+
g := newGovendorImporter(ctx.Err, true, sm)
206+
g.file = govendorFile{
207+
Ignore: strings.Join([]string{"test", pkg, "linux_amd64", "github.com/sdboyer/"}, " "),
208+
}
209+
210+
m, _, err := g.convert(testGovendorProjectRoot)
211+
if err != nil {
212+
t.Fatal(err)
213+
}
214+
215+
if len(m.Ignored) != 1 {
216+
t.Fatalf("Expected the ignored list to contain 1 project but got %d", len(m.Ignored))
217+
}
218+
219+
p := m.Ignored[0]
220+
if p != pkg {
221+
t.Fatalf("Expected the ignored list to have an element for %s but got '%s'", pkg, p)
222+
}
223+
}
224+
193225
func TestGovendorConfig_Convert_BadInput_EmptyPackagePath(t *testing.T) {
194226
h := test.NewHelper(t)
195227
defer h.Cleanup()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Import govendor config in vendor dir.

cmd/dep/testdata/harness_tests/init/govendor/case1/final/Gopkg.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ignored = ["github.com/sdboyer/dep-test","github.com/golang/notexist/samples"]
2+
3+
[[constraint]]
4+
name = "github.com/sdboyer/deptestdos"
5+
version = "2.0.0"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/sdboyer/deptestdos"
11+
)
12+
13+
func main() {
14+
var x deptestdos.Bar
15+
fmt.Println(x)
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package samples
6+
7+
import dt "github.com/carolynvs/go-dep-test"
8+
9+
func Sample1() int {
10+
var x = dt.Thing
11+
return x
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"comment": "",
3+
"ignore": "test github.com/sdboyer/dep-test",
4+
"package": [
5+
{
6+
"checksumSHA1": "4R6TQcq0/gI/I2kKeUunuO/pEec=",
7+
"origin": "github.com/carolynvs/deptest",
8+
"path": "github.com/sdboyer/deptest",
9+
"revision": "3f4c3bea144e112a69bbe5d8d01c1b09a544253f",
10+
"revisionTime": "2017-02-22T03:31:47Z"
11+
},
12+
{
13+
"checksumSHA1": "96YwrJjpE07ENey/eDWWnCWKQOw=",
14+
"path": "github.com/sdboyer/deptestdos",
15+
"revision": "5c607206be5decd28e6263ffffdcee067266015e",
16+
"revisionTime": "2017-02-22T03:34:58Z",
17+
"version": "v2",
18+
"versionExact": "v2.0.0"
19+
}
20+
],
21+
"rootPath": "github.com/golang/notexist"
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-gopath"]
4+
],
5+
"error-expected": "",
6+
"gopath-initial": {
7+
"github.com/sdboyer/deptest": "3f4c3bea144e112a69bbe5d8d01c1b09a544253f",
8+
"github.com/sdboyer/deptestdos": "5c607206be5decd28e6263ffffdcee067266015e"
9+
},
10+
"vendor-final": [
11+
"github.com/sdboyer/deptest",
12+
"github.com/sdboyer/deptestdos"
13+
]
14+
}

0 commit comments

Comments
 (0)