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

Adding new dependency logging #194

Merged
merged 1 commit into from
Jan 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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