Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8233f79

Browse files
committedMay 18, 2017
Cleanup init verbose output
- Remove "dep:" prefix logs. - Remove logging gps solution lock constraints, instead enumerate not on disk projects.
1 parent cfdd731 commit 8233f79

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
@@ -98,16 +98,10 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
9898
if err != nil {
9999
return errors.Wrap(err, "determineProjectRoot")
100100
}
101-
if ctx.Loggers.Verbose {
102-
ctx.Loggers.Err.Printf("dep: Finding dependencies for %q...\n", cpr)
103-
}
104101
pkgT, err := pkgtree.ListPackages(root, cpr)
105102
if err != nil {
106103
return errors.Wrap(err, "gps.ListPackages")
107104
}
108-
if ctx.Loggers.Verbose {
109-
ctx.Loggers.Err.Printf("dep: Found %d dependencies.\n", len(pkgT.Packages))
110-
}
111105
sm, err := ctx.SourceManager()
112106
if err != nil {
113107
return errors.Wrap(err, "getSourceManager")
@@ -148,14 +142,20 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
148142
)
149143
}
150144

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

155158
// Run solver with project versions found on disk
156-
if ctx.Loggers.Verbose {
157-
ctx.Loggers.Err.Println("dep: Solving...")
158-
}
159159
params := gps.SolveParameters{
160160
RootDir: root,
161161
RootPackageTree: pkgT,
@@ -192,14 +192,9 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
192192
}
193193
}
194194
if newProject {
195-
// Check if it's in notondisk project map. These are direct deps, should
196-
// be added to manifest.
197-
if _, ok := pd.notondisk[pr]; ok {
195+
// If it's in notondisk, add to manifest, these are direct dependencies.
196+
if contains(notondisk, string(pr)) {
198197
m.Dependencies[pr] = getProjectPropertiesFromVersion(x.Version())
199-
feedback(x.Version(), pr, fb.DepTypeDirect, ctx)
200-
} else {
201-
// Log feedback of transitive project
202-
feedback(x.Version(), pr, fb.DepTypeTransitive, ctx)
203198
}
204199
}
205200
}
@@ -222,10 +217,6 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
222217
ctx.Loggers.Err.Printf("Old vendor backed up to %v", vendorbak)
223218
}
224219

225-
if ctx.Loggers.Verbose {
226-
ctx.Loggers.Err.Println("dep: Writing manifest and lock files.")
227-
}
228-
229220
sw, err := dep.NewSafeWriter(m, nil, l, dep.VendorAlways)
230221
if err != nil {
231222
return err
@@ -373,9 +364,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
373364
return projectData{}, nil
374365
}
375366

376-
if ctx.Loggers.Verbose {
377-
ctx.Loggers.Err.Println("dep: Building dependency graph...")
378-
}
379367
// Exclude stdlib imports from the list returned from Flatten().
380368
const omitStdlib = false
381369
for _, ip := range rm.Flatten(omitStdlib) {
@@ -392,17 +380,10 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
392380
syncDepGroup.Add(1)
393381
go syncDep(pr, sm)
394382

395-
if ctx.Loggers.Verbose {
396-
ctx.Loggers.Err.Printf("dep: Found import of %q, analyzing...\n", ip)
397-
}
398-
399383
dependencies[pr] = []string{ip}
400384
v, err := ctx.VersionInWorkspace(pr)
401385
if err != nil {
402386
notondisk[pr] = true
403-
if ctx.Loggers.Verbose {
404-
ctx.Loggers.Err.Printf("dep: Could not determine version for %q, omitting from generated manifest\n", pr)
405-
}
406387
continue
407388
}
408389

@@ -415,9 +396,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
415396
feedback(v, pr, fb.DepTypeDirect, ctx)
416397
}
417398

418-
if ctx.Loggers.Verbose {
419-
ctx.Loggers.Err.Printf("dep: Analyzing transitive imports...\n")
420-
}
421399
// Explore the packages we've found for transitive deps, either
422400
// completing the lock or identifying (more) missing projects that we'll
423401
// need to ask gps to solve for us.
@@ -436,9 +414,6 @@ func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.S
436414
dft = func(pkg string) error {
437415
switch colors[pkg] {
438416
case white:
439-
if ctx.Loggers.Verbose {
440-
ctx.Loggers.Err.Printf("dep: Analyzing %q...\n", pkg)
441-
}
442417
colors[pkg] = grey
443418

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

0 commit comments

Comments
 (0)
This repository has been archived.