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

Commit fe2e56f

Browse files
committed
Adding UX output to dep init
1 parent d62440d commit fe2e56f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/dep/init.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
136136
if ctx.Verbose {
137137
ctx.Out.Println("Getting direct dependencies...")
138138
}
139-
pkgT, directDeps, err := getDirectDependencies(sm, p)
139+
pkgT, directDeps, err := getDirectDependencies(sm, p, ctx)
140140
if err != nil {
141141
return err
142142
}
@@ -226,7 +226,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
226226
return nil
227227
}
228228

229-
func getDirectDependencies(sm gps.SourceManager, p *dep.Project) (pkgtree.PackageTree, map[string]bool, error) {
229+
func getDirectDependencies(sm gps.SourceManager, p *dep.Project, ctx *dep.Ctx) (pkgtree.PackageTree, map[string]bool, error) {
230230
pkgT, err := pkgtree.ListPackages(p.ResolvedAbsRoot, string(p.ImportRoot))
231231
if err != nil {
232232
return pkgtree.PackageTree{}, nil, errors.Wrap(err, "gps.ListPackages")
@@ -239,6 +239,9 @@ func getDirectDependencies(sm gps.SourceManager, p *dep.Project) (pkgtree.Packag
239239
if err != nil {
240240
return pkgtree.PackageTree{}, nil, err
241241
}
242+
if !directDeps[string(pr)] {
243+
ctx.Out.Printf("Cached %s ", string(pr))
244+
}
242245
directDeps[string(pr)] = true
243246
}
244247

cmd/dep/init_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestGetDirectDependencies_ConsolidatesRootProjects(t *testing.T) {
3030
testpath := h.Path(testdir)
3131
prj := &dep.Project{AbsRoot: testpath, ResolvedAbsRoot: testpath, ImportRoot: gps.ProjectRoot(testprj)}
3232

33-
_, dd, err := getDirectDependencies(sm, prj)
33+
_, dd, err := getDirectDependencies(sm, prj, NewTestContext(h))
3434
h.Must(err)
3535

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

0 commit comments

Comments
 (0)