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

Commit

Permalink
Logging out a message to the user whenever a new dependency is found.
Browse files Browse the repository at this point in the history
  • Loading branch information
xmattstrongx committed Jan 31, 2017
1 parent 6a70bc2 commit fbf21bd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/dep/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
if err := sw.WriteAllSafe(false); err != nil {
return errors.Wrap(err, "safe write of manifest and lock")
}

return nil
}

Expand Down Expand Up @@ -237,6 +238,15 @@ func getProjectData(ctx *dep.Ctx, pkgT gps.PackageTree, cpr string, sm *gps.Sour
packages := make(map[string]bool)
notondisk := make(map[gps.ProjectRoot]bool)
ondisk := make(map[gps.ProjectRoot]gps.Version)

syncDep := func(pr gps.ProjectRoot, sm *gps.SourceMgr) {
message := "Cached"
if err := sm.SyncSourceFor(gps.ProjectIdentifier{ProjectRoot: pr}); err != nil {
message = "Unable to cache"
}
fmt.Fprintf(os.Stderr, "%s %s\n", message, pr)
}

for _, v := range pkgT.Packages {
// TODO: Some errors maybe should not be skipped ;-)
if v.Err != nil {
Expand Down Expand Up @@ -266,6 +276,8 @@ func getProjectData(ctx *dep.Ctx, pkgT gps.PackageTree, cpr string, sm *gps.Sour

continue
}
go syncDep(pr, sm)

vlogf("Package %q has import %q, analyzing...", v.P.ImportPath, ip)

dependencies[pr] = []string{ip}
Expand Down Expand Up @@ -363,6 +375,7 @@ func getProjectData(ctx *dep.Ctx, pkgT gps.PackageTree, cpr string, sm *gps.Sour
}
} else {
dependencies[pr] = []string{pkg}
go syncDep(pr, sm)
}

// project must be on disk at this point; question is
Expand Down

0 comments on commit fbf21bd

Please sign in to comment.