@@ -8,14 +8,12 @@ import (
8
8
"context"
9
9
"io/ioutil"
10
10
"log"
11
- "strings"
12
11
13
12
"golang.org/x/sync/errgroup"
14
13
15
14
"github.com/golang/dep"
16
15
fb "github.com/golang/dep/internal/feedback"
17
16
"github.com/golang/dep/internal/gps"
18
- "github.com/golang/dep/internal/gps/paths"
19
17
"github.com/golang/dep/internal/importers"
20
18
)
21
19
@@ -64,7 +62,6 @@ func (a *rootAnalyzer) InitializeRootManifestAndLock(dir string, pr gps.ProjectR
64
62
}
65
63
66
64
func (a * rootAnalyzer ) cacheDeps (pr gps.ProjectRoot ) error {
67
- deps := make (map [gps.ProjectRoot ]bool )
68
65
logger := a .ctx .Err
69
66
g , ctx := errgroup .WithContext (context .TODO ())
70
67
sem := make (chan struct {}, concurrency )
@@ -80,48 +77,28 @@ func (a *rootAnalyzer) cacheDeps(pr gps.ProjectRoot) error {
80
77
81
78
for ip := range a .directDeps {
82
79
logger .Printf ("Package %q, analyzing..." , ip )
83
- if paths .IsStandardImportPath (ip ) {
84
- continue
85
- }
86
- if hasImportPathPrefix (ip , string (pr )) {
87
- continue
88
- }
89
-
90
80
pr , err := a .sm .DeduceProjectRoot (ip )
91
81
if err != nil {
92
82
return err
93
83
}
94
84
95
- if _ , ok := deps [pr ]; ok {
96
- continue
97
- }
98
-
99
85
g .Go (func () error {
100
86
select {
101
87
case sem <- struct {}{}:
102
88
defer func () { <- sem }()
103
89
case <- ctx .Done ():
104
90
return ctx .Err ()
105
91
}
106
- err := syncDep (pr , a .sm )
107
- return err
92
+ return syncDep (pr , a .sm )
108
93
})
109
-
110
- deps [pr ] = true
111
94
}
112
- if err := g .Wait (); err = = nil {
113
- logger . Printf ( "Successfully cached all deps." )
95
+ if err := g .Wait (); err ! = nil {
96
+ return err
114
97
}
98
+ logger .Printf ("Successfully cached all deps." )
115
99
return nil
116
100
}
117
101
118
- func hasImportPathPrefix (s , prefix string ) bool {
119
- if s == prefix {
120
- return true
121
- }
122
- return strings .HasPrefix (s , prefix + "/" )
123
- }
124
-
125
102
func (a * rootAnalyzer ) importManifestAndLock (dir string , pr gps.ProjectRoot , suppressLogs bool ) (* dep.Manifest , * dep.Lock , error ) {
126
103
logger := a .ctx .Err
127
104
if suppressLogs {
0 commit comments