fix: fix error info start capitalized

Signed-off-by: zhangyue <zy675793960@yeah.net>
This commit is contained in:
zhangyue 2018-11-24 21:37:54 +08:00
parent dcb82064d3
commit 996c60616a
4 changed files with 8 additions and 8 deletions

View File

@ -295,7 +295,7 @@ func applyNaive(ctx context.Context, root string, tr *tar.Reader, options ApplyO
linkBasename := filepath.Base(hdr.Linkname) linkBasename := filepath.Base(hdr.Linkname)
srcHdr = aufsHardlinks[linkBasename] srcHdr = aufsHardlinks[linkBasename]
if srcHdr == nil { if srcHdr == nil {
return 0, fmt.Errorf("Invalid aufs hardlink") return 0, fmt.Errorf("invalid aufs hardlink")
} }
p, err := fs.RootPath(aufsTempdir, linkBasename) p, err := fs.RootPath(aufsTempdir, linkBasename)
if err != nil { if err != nil {

View File

@ -37,10 +37,10 @@ func WithProfile(profile string) oci.SpecOpts {
s.Linux.Seccomp = &specs.LinuxSeccomp{} s.Linux.Seccomp = &specs.LinuxSeccomp{}
f, err := ioutil.ReadFile(profile) f, err := ioutil.ReadFile(profile)
if err != nil { if err != nil {
return fmt.Errorf("Cannot load seccomp profile %q: %v", profile, err) return fmt.Errorf("cannot load seccomp profile %q: %v", profile, err)
} }
if err := json.Unmarshal(f, s.Linux.Seccomp); err != nil { if err := json.Unmarshal(f, s.Linux.Seccomp); err != nil {
return fmt.Errorf("Decoding seccomp profile failed %q: %v", profile, err) return fmt.Errorf("decoding seccomp profile failed %q: %v", profile, err)
} }
return nil return nil
} }

View File

@ -68,7 +68,7 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
numFields := len(fields) numFields := len(fields)
if numFields < 10 { if numFields < 10 {
// should be at least 10 fields // should be at least 10 fields
return nil, fmt.Errorf("Parsing '%s' failed: not enough fields (%d)", text, numFields) return nil, fmt.Errorf("parsing '%s' failed: not enough fields (%d)", text, numFields)
} }
p := Info{} p := Info{}
// ignore any numbers parsing errors, as there should not be any // ignore any numbers parsing errors, as there should not be any
@ -76,7 +76,7 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
p.Parent, _ = strconv.Atoi(fields[1]) p.Parent, _ = strconv.Atoi(fields[1])
mm := strings.Split(fields[2], ":") mm := strings.Split(fields[2], ":")
if len(mm) != 2 { if len(mm) != 2 {
return nil, fmt.Errorf("Parsing '%s' failed: unexpected minor:major pair %s", text, mm) return nil, fmt.Errorf("parsing '%s' failed: unexpected minor:major pair %s", text, mm)
} }
p.Major, _ = strconv.Atoi(mm[0]) p.Major, _ = strconv.Atoi(mm[0])
p.Minor, _ = strconv.Atoi(mm[1]) p.Minor, _ = strconv.Atoi(mm[1])
@ -101,11 +101,11 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
} }
} }
if i == numFields { if i == numFields {
return nil, fmt.Errorf("Parsing '%s' failed: missing separator ('-')", text) return nil, fmt.Errorf("parsing '%s' failed: missing separator ('-')", text)
} }
// There should be 3 fields after the separator... // There should be 3 fields after the separator...
if i+4 > numFields { if i+4 > numFields {
return nil, fmt.Errorf("Parsing '%s' failed: not enough fields after a separator", text) return nil, fmt.Errorf("parsing '%s' failed: not enough fields after a separator", text)
} }
// ... but in Linux <= 3.9 mounting a cifs with spaces in a share name // ... but in Linux <= 3.9 mounting a cifs with spaces in a share name
// (like "//serv/My Documents") _may_ end up having a space in the last field // (like "//serv/My Documents") _may_ end up having a space in the last field

View File

@ -103,7 +103,7 @@ func waitForPid(process *os.Process) (int, error) {
case pid := <-c: case pid := <-c:
return pid, nil return pid, nil
case <-time.After(10 * time.Second): case <-time.After(10 * time.Second):
return 0, errors.New("Process did not start in 10 seconds") return 0, errors.New("process did not start in 10 seconds")
} }
} }