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

Commit f6be53c

Browse files
authored
Merge pull request #604 from darkowlzz/512-followup-clean-init-verbose
Cleanup init verbose output
2 parents e0c7ec3 + 2ae37d6 commit f6be53c

File tree

1 file changed

+12
-37
lines changed

1 file changed

+12
-37
lines changed

cmd/dep/init.go

+12-37
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,10 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
104104
if err != nil {
105105
return errors.Wrap(err, "determineProjectRoot")
106106
}
107-
if ctx.Loggers.Verbose {
108-
ctx.Loggers.Err.Printf("dep: Finding dependencies for %q...\n", cpr)
109-
}
110107
pkgT, err := pkgtree.ListPackages(root, cpr)
111108
if err != nil {
112109
return errors.Wrap(err, "gps.ListPackages")
113110
}
114-
if ctx.Loggers.Verbose {
115-
ctx.Loggers.Err.Printf("dep: Found %d dependencies.\n", len(pkgT.Packages))
116-
}
117111
sm, err := ctx.SourceManager()
118112
if err != nil {
119113
return errors.Wrap(err, "getSourceManager")
@@ -154,14 +148,20 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
154148
)
155149
}
156150

157-
ctx.Loggers.Err.Println("Using network for remaining projects...")
151+
// Create a string slice of not on disk projects
152+
var notondisk []string
153+
for pname, _ := range pd.notondisk {
154+
notondisk = append(notondisk, string(pname))
155+
}
156+
157+
ctx.Loggers.Err.Printf("Following dependencies were not found in GOPATH. "+
158+
"Dep will use the most recent versions of these projects.\n %s",
159+
strings.Join(notondisk, "\n "))
160+
158161
// Copy lock before solving. Use this to separate new lock projects from soln
159162
copyLock := *l
160163

161164
// Run solver with project versions found on disk
162-
if ctx.Loggers.Verbose {
163-
ctx.Loggers.Err.Println("dep: Solving...")
164-
}
165165
params := gps.SolveParameters{
166166
RootDir: root,
167167
RootPackageTree: pkgT,
@@ -187,7 +187,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
187187
l = dep.LockFromInterface(soln)
188188

189189
// Iterate through the new projects in solved lock and add them to manifest
190-
// if direct deps and log feedback for all the new projects.
190+
// if direct deps
191191
for _, x := range l.Projects() {
192192
pr := x.Ident().ProjectRoot
193193
newProject := true
@@ -198,14 +198,9 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
198198
}
199199
}
200200
if newProject {
201-
// Check if it's in notondisk project map. These are direct deps, should
202-
// be added to manifest.
201+
// If it's in notondisk, add to manifest, these are direct dependencies.
203202
if _, ok := pd.notondisk[pr]; ok {
204203
m.Dependencies[pr] = getProjectPropertiesFromVersion(x.Version())
205-
feedback(x.Version(), pr, fb.DepTypeDirect, ctx)
206-
} else {
207-
// Log feedback of transitive project
208-
feedback(x.Version(), pr, fb.DepTypeTransitive, ctx)
209204
}
210205
}
211206
}
@@ -228,10 +223,6 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
228223
ctx.Loggers.Err.Printf("Old vendor backed up to %v", vendorbak)
229224
}
230225

231-
if ctx.Loggers.Verbose {
232-
ctx.Loggers.Err.Println("dep: Writing manifest and lock files.")
233-
}
234-
235226
sw, err := dep.NewSafeWriter(m, nil, l, dep.VendorAlways)
236227
if err != nil {
237228
return err
@@ -379,9 +370,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
379370
return projectData{}, nil
380371
}
381372

382-
if ctx.Loggers.Verbose {
383-
ctx.Loggers.Err.Println("dep: Building dependency graph...")
384-
}
385373
for _, ip := range rm.FlattenOmitStdLib() {
386374
pr, err := sm.DeduceProjectRoot(ip)
387375
if err != nil {
@@ -396,17 +384,10 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
396384
syncDepGroup.Add(1)
397385
go syncDep(pr, sm)
398386

399-
if ctx.Loggers.Verbose {
400-
ctx.Loggers.Err.Printf("dep: Found import of %q, analyzing...\n", ip)
401-
}
402-
403387
dependencies[pr] = []string{ip}
404388
v, err := ctx.VersionInWorkspace(pr)
405389
if err != nil {
406390
notondisk[pr] = true
407-
if ctx.Loggers.Verbose {
408-
ctx.Loggers.Err.Printf("dep: Could not determine version for %q, omitting from generated manifest\n", pr)
409-
}
410391
continue
411392
}
412393

@@ -419,9 +400,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
419400
feedback(v, pr, fb.DepTypeDirect, ctx)
420401
}
421402

422-
if ctx.Loggers.Verbose {
423-
ctx.Loggers.Err.Printf("dep: Analyzing transitive imports...\n")
424-
}
425403
// Explore the packages we've found for transitive deps, either
426404
// completing the lock or identifying (more) missing projects that we'll
427405
// need to ask gps to solve for us.
@@ -440,9 +418,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
440418
dft = func(pkg string) error {
441419
switch colors[pkg] {
442420
case white:
443-
if ctx.Loggers.Verbose {
444-
ctx.Loggers.Err.Printf("dep: Analyzing %q...\n", pkg)
445-
}
446421
colors[pkg] = grey
447422

448423
pr, err := sm.DeduceProjectRoot(pkg)

0 commit comments

Comments
 (0)