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 f760ff8

Browse files
committedNov 20, 2017
status: project status error out when project is not in lock
1 parent cb211a7 commit f760ff8

File tree

8 files changed

+120
-0
lines changed

8 files changed

+120
-0
lines changed
 

‎cmd/dep/status.go

+6
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ func runProjectStatus(ctx *dep.Ctx, args []string, p *dep.Project, sm gps.Source
822822
if err != nil {
823823
return err
824824
}
825+
826+
// Check if the target project is in the lock.
827+
if !p.Lock.HasProjectWithRoot(pr) {
828+
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)
829+
}
830+
825831
prs = append(prs, pr)
826832
}
827833

‎cmd/dep/testdata/harness_tests/status/project_status_not_in_lock/final/Gopkg.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[constraint]]
2+
branch = "master"
3+
name = "github.com/darkowlzz/deptest-project-status"
4+
5+
[[constraint]]
6+
name = "github.com/sdboyer/deptest"
7+
version = "1.0.0"
8+
9+
[[constraint]]
10+
name = "github.com/sdboyer/deptestdos"
11+
version = "2.0.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
_ "github.com/darkowlzz/deptest-project-status/pkgfoo"
9+
_ "github.com/sdboyer/deptest"
10+
_ "github.com/sdboyer/deptestdos"
11+
)
12+
13+
func main() {}

‎cmd/dep/testdata/harness_tests/status/project_status_not_in_lock/initial/Gopkg.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[constraint]]
2+
branch = "master"
3+
name = "github.com/darkowlzz/deptest-project-status"
4+
5+
[[constraint]]
6+
name = "github.com/sdboyer/deptest"
7+
version = "1.0.0"
8+
9+
[[constraint]]
10+
name = "github.com/sdboyer/deptestdos"
11+
version = "2.0.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
_ "github.com/darkowlzz/deptest-project-status/pkgfoo"
9+
_ "github.com/sdboyer/deptest"
10+
_ "github.com/sdboyer/deptestdos"
11+
)
12+
13+
func main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"commands": [
3+
["ensure"],
4+
["status", "github.com/golang/dep"]
5+
],
6+
"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.",
7+
"vendor-final": [
8+
"github.com/darkowlzz/deptest-project-status",
9+
"github.com/sdboyer/deptest",
10+
"github.com/sdboyer/deptestdos"
11+
]
12+
}

0 commit comments

Comments
 (0)
This repository has been archived.