This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree 3 files changed +23
-5
lines changed
3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ type RootManifest interface {
50
50
//
51
51
// It is an error to include a package in both the ignored and required
52
52
// sets.
53
- IgnoredPackages () map [string ]bool
53
+ IgnoredPackages (SolveParameters ) map [string ]bool
54
54
55
55
// RequiredPackages returns a set of import paths to require. These packages
56
56
// are required to be present in any solution. The list can include main
@@ -103,7 +103,7 @@ func (m simpleRootManifest) TestDependencyConstraints() ProjectConstraints {
103
103
func (m simpleRootManifest ) Overrides () ProjectConstraints {
104
104
return m .ovr
105
105
}
106
- func (m simpleRootManifest ) IgnoredPackages () map [string ]bool {
106
+ func (m simpleRootManifest ) IgnoredPackages (SolveParameters ) map [string ]bool {
107
107
return m .ig
108
108
}
109
109
func (m simpleRootManifest ) RequiredPackages () map [string ]bool {
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ func (params SolveParameters) toRootdata() (rootdata, error) {
183
183
}
184
184
185
185
rd := rootdata {
186
- ig : params .Manifest .IgnoredPackages (),
186
+ ig : params .Manifest .IgnoredPackages (params ),
187
187
req : params .Manifest .RequiredPackages (),
188
188
ovr : params .Manifest .Overrides (),
189
189
rpt : params .RootPackageTree .Copy (),
Original file line number Diff line number Diff line change @@ -8,11 +8,14 @@ import (
8
8
"bytes"
9
9
"fmt"
10
10
"io"
11
+ "path/filepath"
11
12
"reflect"
12
13
"regexp"
13
14
"sort"
15
+ "strings"
14
16
15
17
"github.com/golang/dep/internal/gps"
18
+ "github.com/golang/dep/internal/gps/pkgtree"
16
19
"github.com/pelletier/go-toml"
17
20
"github.com/pkg/errors"
18
21
)
@@ -282,14 +285,29 @@ func (m *Manifest) Overrides() gps.ProjectConstraints {
282
285
}
283
286
284
287
// IgnoredPackages returns a set of import paths to ignore.
285
- func (m * Manifest ) IgnoredPackages () map [string ]bool {
288
+ func (m * Manifest ) IgnoredPackages (solveParam gps. SolveParameters ) map [string ]bool {
286
289
if len (m .Ignored ) == 0 {
287
290
return nil
288
291
}
289
292
290
293
mp := make (map [string ]bool , len (m .Ignored ))
291
294
for _ , i := range m .Ignored {
292
- mp [i ] = true
295
+ // Check if the path has glob syntax (/...)
296
+ dir , base := filepath .Split (i )
297
+ if base == "..." {
298
+ pkgT , _ := pkgtree .ListPackages (filepath .Join (solveParam .RootDir , dir ), dir )
299
+
300
+ // Ignored root packages found in package tree of ignored package
301
+ for p := range pkgT .Packages {
302
+ for rp := range solveParam .RootPackageTree .Packages {
303
+ if strings .HasSuffix (rp , p ) {
304
+ mp [rp ] = true
305
+ }
306
+ }
307
+ }
308
+ } else {
309
+ mp [i ] = true
310
+ }
293
311
}
294
312
295
313
return mp
You can’t perform that action at this time.
0 commit comments