зеркало из https://github.com/golang/dep.git
better wording of errors
fix nil being passed to errors.Wrap() Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
Родитель
5b2ff11262
Коммит
685d5fc0f0
|
@ -111,6 +111,7 @@ func (cmd *ensureCommand) Run(args []string) error {
|
|||
pc, err := getProjectConstraint(arg, sm)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if gps.IsAny(pc.Constraint) && pc.Ident.Source == "" {
|
||||
|
@ -145,6 +146,7 @@ func (cmd *ensureCommand) Run(args []string) error {
|
|||
pc, err := getProjectConstraint(ovr, sm)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Empty overrides are fine (in contrast to deps), because they actually
|
||||
|
@ -166,7 +168,7 @@ func (cmd *ensureCommand) Run(args []string) error {
|
|||
|
||||
if len(errs) > 0 {
|
||||
var buf bytes.Buffer
|
||||
for err := range errs {
|
||||
for _, err := range errs {
|
||||
fmt.Fprintln(&buf, err)
|
||||
}
|
||||
|
||||
|
@ -293,7 +295,7 @@ func getProjectConstraint(arg string, sm *gps.SourceMgr) (gps.ProjectConstraint,
|
|||
}
|
||||
|
||||
if string(pr) != arg {
|
||||
return constraint, errors.Wrapf(err, "dependency path %s is not a project root", arg)
|
||||
return constraint, fmt.Errorf("dependency path %s is not a project root, try %s instead", arg, pr)
|
||||
}
|
||||
constraint.Ident.ProjectRoot = gps.ProjectRoot(arg)
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -138,7 +138,7 @@ func resetUsage(fs *flag.FlagSet, name, args, longHelp string) {
|
|||
}
|
||||
|
||||
var (
|
||||
errProjectNotFound = errors.New("no project could be found")
|
||||
errProjectNotFound = errors.New("could not find project manifest.json")
|
||||
)
|
||||
|
||||
func findProjectRootFromWD() (string, error) {
|
||||
|
|
|
@ -150,7 +150,7 @@ func toPossible(pp gps.ProjectProperties) (p possibleProps) {
|
|||
// the 'any' case, because that's the other possibility, and it's what
|
||||
// we interpret not having any constraint expressions at all to mean.
|
||||
//if !gps.IsAny(pp.Constraint) && !gps.IsNone(pp.Constraint) {
|
||||
if !gps.IsAny(pp.Constraint) {
|
||||
if !gps.IsAny(pp.Constraint) && pp.Constraint != nil {
|
||||
// Has to be a semver range.
|
||||
p.Version = pp.Constraint.String()
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче