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

Commit 0160c5b

Browse files
committed
fix(status): check lockfile before runStatusAll()
1 parent 0edac3f commit 0160c5b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/dep/status.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
236236
}
237237
}
238238

239+
// Check if the lock file exists.
240+
if p.Lock == nil {
241+
return errors.Errorf("no Gopkg.lock found. Run `dep ensure` to generate lock file")
242+
}
243+
239244
hasMissingPkgs, errCount, err := runStatusAll(ctx, out, p, sm)
240245
if err != nil {
241246
switch err {
@@ -353,10 +358,6 @@ type MissingStatus struct {
353358
}
354359

355360
func runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Project, sm gps.SourceManager) (hasMissingPkgs bool, errCount int, err error) {
356-
if p.Lock == nil {
357-
return false, 0, errors.Errorf("no Gopkg.lock found. Run `dep ensure` to generate lock file")
358-
}
359-
360361
// While the network churns on ListVersions() requests, statically analyze
361362
// code from the current project.
362363
ptree, err := pkgtree.ListPackages(p.ResolvedAbsRoot, string(p.ImportRoot))

0 commit comments

Comments
 (0)