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

Commit c435354

Browse files
committed
status: With -out, still emit to file on err
Fixes #1922.
1 parent bc15279 commit c435354

File tree

1 file changed

+7
-29
lines changed

1 file changed

+7
-29
lines changed

cmd/dep/status.go

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -509,29 +509,19 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
509509
return err
510510
}
511511

512-
hasMissingPkgs, errCount, err := cmd.runStatusAll(ctx, out, p, sm)
513-
if err != nil {
514-
switch err {
512+
_, errCount, runerr := cmd.runStatusAll(ctx, out, p, sm)
513+
if runerr != nil {
514+
switch runerr {
515515
case errFailedUpdate:
516-
// Print the results with unknown data
517-
ctx.Out.Println(buf.String())
518516
// Print the help when in non-verbose mode
519517
if !ctx.Verbose {
520518
ctx.Out.Printf("The status of %d projects are unknown due to errors. Rerun with `-v` flag to see details.\n", errCount)
521519
}
522520
case errInputDigestMismatch:
523-
// Tell the user why mismatch happened and how to resolve it.
524-
if hasMissingPkgs {
525-
ctx.Err.Printf("Lock inputs-digest mismatch due to the following packages missing from the lock:\n\n")
526-
ctx.Out.Print(buf.String())
527-
ctx.Err.Printf("\nThis happens when a new import is added. Run `dep ensure` to install the missing packages.\n")
528-
} else {
529-
ctx.Err.Printf("Lock inputs-digest mismatch. This happens when Gopkg.toml is modified.\n" +
530-
"Run `dep ensure` to regenerate the inputs-digest.")
531-
}
521+
ctx.Err.Printf("Gopkg.lock is out of sync with imports and/or Gopkg.toml. Run `dep check` for details.\n")
522+
default:
523+
return runerr
532524
}
533-
534-
return err
535525
}
536526

537527
if cmd.outFilePath == "" {
@@ -549,7 +539,7 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
549539
}
550540
}
551541

552-
return nil
542+
return runerr
553543
}
554544

555545
func (cmd *statusCommand) validateFlags() error {
@@ -955,19 +945,13 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
955945
errListPkgCh := make(chan error, len(slp))
956946
errListVerCh := make(chan error, len(slp))
957947

958-
// Hardcode to a limit of 16 simultaneous projects. This is plenty high
959-
// enough to gain concurrency benefits, but low enough that we won't
960-
// hit an open fd limit on any OS.
961-
sem := make(chan struct{}, 16)
962948
var wg sync.WaitGroup
963949

964950
for i, proj := range slp {
965951
wg.Add(1)
966952
logger.Printf("(%d/%d) %s\n", i+1, len(slp), proj.Ident().ProjectRoot)
967-
sem <- struct{}{}
968953

969954
go func(proj verify.VerifiableProject) {
970-
defer func() { <-sem }()
971955
bs := BasicStatus{
972956
ProjectRoot: string(proj.Ident().ProjectRoot),
973957
PackageCount: len(proj.Packages()),
@@ -1333,20 +1317,14 @@ func collectConstraints(ctx *dep.Ctx, p *dep.Project, sm gps.SourceManager) (con
13331317
// Channel for receiving all the errors.
13341318
errCh := make(chan error, len(lp))
13351319

1336-
// Hardcode to a limit of 16 simultaneous projects. This is plenty high
1337-
// enough to gain concurrency benefits, but low enough that we won't
1338-
// hit an open fd limit on any OS.
1339-
sem := make(chan struct{}, 16)
13401320
var wg sync.WaitGroup
13411321

13421322
// Iterate through the locked projects and collect constraints of all the projects.
13431323
for i, proj := range lp {
13441324
wg.Add(1)
13451325
logger.Printf("(%d/%d) %s\n", i+1, len(lp), proj.Ident().ProjectRoot)
1346-
sem <- struct{}{}
13471326

13481327
go func(proj gps.LockedProject) {
1349-
defer func() { <-sem }()
13501328
defer wg.Done()
13511329

13521330
manifest, _, err := sm.GetManifestAndLock(proj.Ident(), proj.Version(), rootAnalyzer)

0 commit comments

Comments
 (0)