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

Commit

Permalink
status: project status error out when project is not in lock
Browse files Browse the repository at this point in the history
  • Loading branch information
darkowlzz committed Nov 29, 2017
1 parent f8504fd commit 7de341c
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,12 @@ func runProjectStatus(ctx *dep.Ctx, args []string, p *dep.Project, sm gps.Source
if err != nil {
return err
}

// Check if the target project is in the lock.
if !p.Lock.HasProjectWithRoot(pr) {
return errors.Errorf("%s is not in the lock file. Ensure that the project is being used and run `dep ensure` to generate a new lock file.", pr)
}

prs = append(prs, pr)
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[constraint]]
branch = "master"
name = "github.com/darkowlzz/deptest-project-status"

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "1.0.0"

[[constraint]]
name = "github.com/sdboyer/deptestdos"
version = "2.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
_ "github.com/darkowlzz/deptest-project-status/pkgfoo"
_ "github.com/sdboyer/deptest"
_ "github.com/sdboyer/deptestdos"
)

func main() {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[constraint]]
branch = "master"
name = "github.com/darkowlzz/deptest-project-status"

[[constraint]]
name = "github.com/sdboyer/deptest"
version = "1.0.0"

[[constraint]]
name = "github.com/sdboyer/deptestdos"
version = "2.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
_ "github.com/darkowlzz/deptest-project-status/pkgfoo"
_ "github.com/sdboyer/deptest"
_ "github.com/sdboyer/deptestdos"
)

func main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"commands": [
["ensure"],
["status", "github.com/golang/dep"]
],
"error-expected": "github.com/golang/dep is not in the lock file. Ensure that the project is being used and run `dep ensure` to generate a new lock file.",
"vendor-final": [
"github.com/darkowlzz/deptest-project-status",
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}

0 comments on commit 7de341c

Please sign in to comment.