From f383865ad7bdc699c1f393c0ccfb9f3ce8ef6409 Mon Sep 17 00:00:00 2001 From: mstrong Date: Sat, 28 Jan 2017 18:21:26 -0500 Subject: [PATCH] Logging out a message to the user whenever a new dependency is found. --- cmd/dep/init.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/dep/init.go b/cmd/dep/init.go index 57b59b6c46..6c749b90e3 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -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 } @@ -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) + + printNewDep := func(pr gps.ProjectRoot, sm *gps.SourceMgr) { + message := "Fetched latest of" + if err := sm.SyncSourceFor(gps.ProjectIdentifier{ProjectRoot: pr}); err != nil { + message = "Unable to fetch latest of" + } + 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 { @@ -266,6 +276,8 @@ func getProjectData(ctx *dep.Ctx, pkgT gps.PackageTree, cpr string, sm *gps.Sour continue } + go printNewDep(pr, sm) + vlogf("Package %q has import %q, analyzing...", v.P.ImportPath, ip) dependencies[pr] = []string{ip} @@ -363,6 +375,7 @@ func getProjectData(ctx *dep.Ctx, pkgT gps.PackageTree, cpr string, sm *gps.Sour } } else { dependencies[pr] = []string{pkg} + go printNewDep(pr, sm) } // project must be on disk at this point; question is