forked from kardianos/govendor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
err.go
80 lines (63 loc) · 2.02 KB
/
err.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright 2015 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 context
import (
"errors"
"fmt"
)
var (
// ErrMissingGOROOT returns if the GOROOT was not found.
ErrMissingGOROOT = errors.New("Unable to determine GOROOT.")
// ErrMissingGOPATH returns if no GOPATH was found.
ErrMissingGOPATH = errors.New("Missing GOPATH. Check your environment variable GOPATH.")
)
// ErrNotInGOPATH returns if not currently in the GOPATH.
type ErrNotInGOPATH struct {
Missing string
}
func (err ErrNotInGOPATH) Error() string {
return fmt.Sprintf("Package %q not a go package or not in GOPATH.", err.Missing)
}
// ErrDirtyPackage returns if package is in dirty version control.
type ErrDirtyPackage struct {
ImportPath string
}
func (err ErrDirtyPackage) Error() string {
return fmt.Sprintf("Package %q has uncommited changes in the vcs.", err.ImportPath)
}
// ErrPackageExists returns if package already exists.
type ErrPackageExists struct {
Package string
}
func (err ErrPackageExists) Error() string {
return fmt.Sprintf("Package %q already in vendor.", err.Package)
}
// ErrMissingVendorFile returns if package already exists.
type ErrMissingVendorFile struct {
Path string
}
func (err ErrMissingVendorFile) Error() string {
return fmt.Sprintf("Vendor file at %q not found.", err.Path)
}
// ErrOldVersion returns if vendor file is not in the vendor folder.
type ErrOldVersion struct {
Message string
}
func (err ErrOldVersion) Error() string {
return fmt.Sprintf("The vendor file or is old. %s", err.Message)
}
type ErrTreeChildren struct {
path string
children []*Package
}
func (err ErrTreeChildren) Error() string {
return fmt.Sprintf("Cannot have a sub-tree %q contain sub-packages %q", err.path, err.children)
}
type ErrTreeParents struct {
path string
parents []string
}
func (err ErrTreeParents) Error() string {
return fmt.Sprintf("Cannot add package %q which is already found in sub-tree %q", err.path, err.parents)
}