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

Commit

Permalink
Adding UX output to dep init
Browse files Browse the repository at this point in the history
  • Loading branch information
xmattstrongx committed Sep 17, 2017
1 parent d62440d commit fe2e56f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cmd/dep/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
if ctx.Verbose {
ctx.Out.Println("Getting direct dependencies...")
}
pkgT, directDeps, err := getDirectDependencies(sm, p)
pkgT, directDeps, err := getDirectDependencies(sm, p, ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
return nil
}

func getDirectDependencies(sm gps.SourceManager, p *dep.Project) (pkgtree.PackageTree, map[string]bool, error) {
func getDirectDependencies(sm gps.SourceManager, p *dep.Project, ctx *dep.Ctx) (pkgtree.PackageTree, map[string]bool, error) {
pkgT, err := pkgtree.ListPackages(p.ResolvedAbsRoot, string(p.ImportRoot))
if err != nil {
return pkgtree.PackageTree{}, nil, errors.Wrap(err, "gps.ListPackages")
Expand All @@ -239,6 +239,9 @@ func getDirectDependencies(sm gps.SourceManager, p *dep.Project) (pkgtree.Packag
if err != nil {
return pkgtree.PackageTree{}, nil, err
}
if !directDeps[string(pr)] {
ctx.Out.Printf("Cached %s ", string(pr))
}
directDeps[string(pr)] = true
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/dep/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestGetDirectDependencies_ConsolidatesRootProjects(t *testing.T) {
testpath := h.Path(testdir)
prj := &dep.Project{AbsRoot: testpath, ResolvedAbsRoot: testpath, ImportRoot: gps.ProjectRoot(testprj)}

_, dd, err := getDirectDependencies(sm, prj)
_, dd, err := getDirectDependencies(sm, prj, NewTestContext(h))
h.Must(err)

wantpr := "github.com/carolynvs/deptest-subpkg"
Expand Down

0 comments on commit fe2e56f

Please sign in to comment.