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

fix(status): check lockfile before runStatusAll() #1238

Merged
merged 2 commits into from
Oct 7, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
}
}

// Check if the lock file exists.
if p.Lock == nil {
return errors.Errorf("no Gopkg.lock found. Run `dep ensure` to generate lock file")
}

hasMissingPkgs, errCount, err := runStatusAll(ctx, out, p, sm)
if err != nil {
switch err {
Expand Down Expand Up @@ -353,10 +358,6 @@ type MissingStatus struct {
}

func runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Project, sm gps.SourceManager) (hasMissingPkgs bool, errCount int, err error) {
if p.Lock == nil {
return false, 0, errors.Errorf("no Gopkg.lock found. Run `dep ensure` to generate lock file")
}

// While the network churns on ListVersions() requests, statically analyze
// code from the current project.
ptree, err := pkgtree.ListPackages(p.ResolvedAbsRoot, string(p.ImportRoot))
Expand Down