@@ -17,6 +17,7 @@ import (
17
17
fb "github.com/golang/dep/internal/feedback"
18
18
"github.com/golang/dep/internal/fs"
19
19
"github.com/golang/dep/internal/gps"
20
+ "github.com/golang/dep/internal/gps/paths"
20
21
"github.com/golang/dep/internal/gps/pkgtree"
21
22
"github.com/pkg/errors"
22
23
)
@@ -245,20 +246,6 @@ func contains(a []string, b string) bool {
245
246
return false
246
247
}
247
248
248
- // isStdLib reports whether $GOROOT/src/path should be considered
249
- // part of the standard distribution. For historical reasons we allow people to add
250
- // their own code to $GOROOT instead of using $GOPATH, but we assume that
251
- // code will start with a domain name (dot in the first element).
252
- // This was loving taken from src/cmd/go/pkg.go in Go's code (isStandardImportPath).
253
- func isStdLib (path string ) bool {
254
- i := strings .Index (path , "/" )
255
- if i < 0 {
256
- i = len (path )
257
- }
258
- elem := path [:i ]
259
- return ! strings .Contains (elem , "." )
260
- }
261
-
262
249
// TODO solve failures can be really creative - we need to be similarly creative
263
250
// in handling them and informing the user appropriately
264
251
func handleAllTheFailuresOfTheWorld (err error ) {
@@ -370,7 +357,7 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
370
357
return projectData {}, nil
371
358
}
372
359
373
- for _ , ip := range rm .FlattenOmitStdLib ( ) {
360
+ for _ , ip := range rm .FlattenFn ( paths . IsStandardImportPath ) {
374
361
pr , err := sm .DeduceProjectRoot (ip )
375
362
if err != nil {
376
363
return projectData {}, errors .Wrap (err , "sm.DeduceProjectRoot" ) // TODO: Skip and report ?
@@ -506,7 +493,7 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
506
493
507
494
// recurse
508
495
for _ , rpkg := range reached .External {
509
- if isStdLib (rpkg ) {
496
+ if paths . IsStandardImportPath (rpkg ) {
510
497
continue
511
498
}
512
499
0 commit comments