Skip to content

Commit adc4fa2

Browse files
committed
Use pkg/errors for all errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent c22effb commit adc4fa2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mount/mountinfo_linux.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
7272
numFields := len(fields)
7373
if numFields < 10 {
7474
// should be at least 10 fields
75-
return nil, fmt.Errorf("parsing '%s' failed: not enough fields (%d)", text, numFields)
75+
return nil, errors.Errorf("parsing '%s' failed: not enough fields (%d)", text, numFields)
7676
}
7777
p := Info{}
7878
// ignore any numbers parsing errors, as there should not be any
7979
p.ID, _ = strconv.Atoi(fields[0])
8080
p.Parent, _ = strconv.Atoi(fields[1])
8181
mm := strings.Split(fields[2], ":")
8282
if len(mm) != 2 {
83-
return nil, fmt.Errorf("parsing '%s' failed: unexpected minor:major pair %s", text, mm)
83+
return nil, errors.Errorf("parsing '%s' failed: unexpected minor:major pair %s", text, mm)
8484
}
8585
p.Major, _ = strconv.Atoi(mm[0])
8686
p.Minor, _ = strconv.Atoi(mm[1])
@@ -111,11 +111,11 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
111111
}
112112
}
113113
if i == numFields {
114-
return nil, fmt.Errorf("parsing '%s' failed: missing separator ('-')", text)
114+
return nil, errors.Errorf("parsing '%s' failed: missing separator ('-')", text)
115115
}
116116
// There should be 3 fields after the separator...
117117
if i+4 > numFields {
118-
return nil, fmt.Errorf("parsing '%s' failed: not enough fields after a separator", text)
118+
return nil, errors.Errorf("parsing '%s' failed: not enough fields after a separator", text)
119119
}
120120
// ... but in Linux <= 3.9 mounting a cifs with spaces in a share name
121121
// (like "//serv/My Documents") _may_ end up having a space in the last field

0 commit comments

Comments
 (0)