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

Commit 551799e

Browse files
authored
Merge branch 'master' into paths_pkg
2 parents 90b178e + a90bfbb commit 551799e

File tree

8 files changed

+40
-5
lines changed

8 files changed

+40
-5
lines changed

FAQ.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Summarize the question and quote the reply, linking back to the original comment
1818
* [Can I put the manifest and lock in the vendor directory?](#can-i-put-the-manifest-and-lock-in-the-vendor-directory)
1919
* [Why did dep use a different revision for package X instead of the revision in the lock file?](#why-did-dep-use-a-different-revision-for-package-x-instead-of-the-revision-in-the-lock-file)
2020
* [Why is `dep` slow?](#why-is-dep-slow)
21+
* [How does `dep` handle symbolic links?](#how-does-dep-handle-symbolic-links)
2122

2223
## What is the difference between Gopkg.toml (the "manifest") and Gopkg.lock (the "lock")?
2324

@@ -178,4 +179,16 @@ gateway to all of these improvements.
178179

179180
There's another major performance issue that's much harder - the process of picking versions itself is an NP-complete problem in `dep`'s current design. This is a much trickier problem 😜
180181

182+
## How does `dep` handle symbolic links?
183+
184+
> because we're not crazy people who delight in inviting chaos into our lives, we need to work within one GOPATH at a time.
185+
-[@sdboyer in #247](https://github.com/golang/dep/pull/247#issuecomment-284181879)
186+
187+
Out of convenience, one might create a symlink to a directory within their `GOPATH`, e.g. `ln -s ~/go/src/github.com/golang/dep dep`. When `dep` is invoked it will resolve the current working directory accordingly:
188+
189+
- If the cwd is a symlink outside a `GOPATH` and links to directory within a `GOPATH`, or vice versa, `dep` chooses whichever path is within the `GOPATH`. If neither path is within a `GOPATH`, `dep` produces an error.
190+
- If both the cwd and resolved path are in the same `GOPATH`, an error is thrown since the users intentions and expectations can't be accurately deduced.
191+
- If the symlink is within a `GOPATH` and the real path is within a *different* `GOPATH` - an error is thrown.
192+
193+
This is the only symbolic link support that `dep` really intends to provide. In keeping with the general practices of the `go` tool, `dep` tends to either ignore symlinks (when walking) or copy the symlink itself, depending on the filesystem operation being performed.
181194

cmd/dep/ensure_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
)
1212

1313
func TestDeduceConstraint(t *testing.T) {
14+
t.Parallel()
15+
1416
sv, err := gps.NewSemverConstraint("v1.2.3")
1517
if err != nil {
1618
t.Fatal(err)

cmd/dep/graphviz_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import (
1111
)
1212

1313
func TestEmptyProject(t *testing.T) {
14-
g := new(graphviz).New()
1514
h := test.NewHelper(t)
15+
h.Parallel()
1616
defer h.Cleanup()
1717

18+
g := new(graphviz).New()
19+
1820
b := g.output()
1921
want := h.GetTestFileString("graphviz/empty.dot")
2022

@@ -24,10 +26,12 @@ func TestEmptyProject(t *testing.T) {
2426
}
2527

2628
func TestSimpleProject(t *testing.T) {
27-
g := new(graphviz).New()
2829
h := test.NewHelper(t)
30+
h.Parallel()
2931
defer h.Cleanup()
3032

33+
g := new(graphviz).New()
34+
3135
g.createNode("project", "", []string{"foo", "bar"})
3236
g.createNode("foo", "master", []string{"bar"})
3337
g.createNode("bar", "dev", []string{})
@@ -40,10 +44,12 @@ func TestSimpleProject(t *testing.T) {
4044
}
4145

4246
func TestNoLinks(t *testing.T) {
43-
g := new(graphviz).New()
4447
h := test.NewHelper(t)
48+
h.Parallel()
4549
defer h.Cleanup()
4650

51+
g := new(graphviz).New()
52+
4753
g.createNode("project", "", []string{})
4854

4955
b := g.output()
@@ -54,6 +60,8 @@ func TestNoLinks(t *testing.T) {
5460
}
5561

5662
func TestIsPathPrefix(t *testing.T) {
63+
t.Parallel()
64+
5765
tcs := []struct {
5866
path string
5967
pre string

cmd/dep/init_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
)
1313

1414
func TestContains(t *testing.T) {
15+
t.Parallel()
16+
1517
a := []string{"a", "b", "abcd"}
1618

1719
if !contains(a, "a") {
@@ -23,6 +25,8 @@ func TestContains(t *testing.T) {
2325
}
2426

2527
func TestGetProjectPropertiesFromVersion(t *testing.T) {
28+
t.Parallel()
29+
2630
wantSemver, _ := gps.NewSemverConstraint("^v1.0.0")
2731
cases := []struct {
2832
version, want gps.Constraint

cmd/dep/integration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
)
1919

2020
func TestIntegration(t *testing.T) {
21+
t.Parallel()
22+
2123
test.NeedsExternalNetwork(t)
2224
test.NeedsGit(t)
2325

cmd/dep/remove_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
)
1313

1414
func TestRemoveErrors(t *testing.T) {
15+
t.Parallel()
16+
1517
test.NeedsExternalNetwork(t)
1618
test.NeedsGit(t)
1719

@@ -27,6 +29,8 @@ func TestRemoveErrors(t *testing.T) {
2729

2830
func removeErrors(name, wd string, externalProc bool, run test.RunFunc) func(*testing.T) {
2931
return func(t *testing.T) {
32+
t.Parallel()
33+
3034
testCase := test.NewTestCase(t, name, "harness_tests", wd)
3135
testProj := test.NewTestProject(t, testCase.InitialPath(), wd, externalProc, run)
3236
defer testProj.Cleanup()

cmd/dep/status_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
)
1212

1313
func TestStatusFormatVersion(t *testing.T) {
14+
t.Parallel()
15+
1416
tests := map[gps.Version]string{
1517
nil: "",
1618
gps.NewBranch("master"): "branch master",

internal/test/test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ func (h *Helper) check(err error) {
7777
}
7878
}
7979

80-
// parallel runs the test in parallel by calling t.Parallel.
81-
func (h *Helper) parallel() {
80+
// Parallel runs the test in parallel by calling t.Parallel.
81+
func (h *Helper) Parallel() {
8282
if h.ran {
8383
h.t.Fatalf("%+v", errors.New("internal testsuite error: call to parallel after run"))
8484
}

0 commit comments

Comments
 (0)