archive,cmd,fs: return err directly

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
This commit is contained in:
unclejack 2017-03-30 11:32:13 +03:00
parent d43628c930
commit e91d6805af
4 changed files with 16 additions and 38 deletions

View file

@ -100,10 +100,7 @@ func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
mode |= syscall.S_IFIFO mode |= syscall.S_IFIFO
} }
if err := syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor))); err != nil { return syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor)))
return err
}
return nil
} }
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error {

View file

@ -49,10 +49,8 @@ var pprofGoroutinesCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }
@ -67,10 +65,8 @@ var pprofHeapCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }
@ -85,10 +81,8 @@ var pprofProfileCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }
@ -112,11 +106,8 @@ var pprofTraceCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }
@ -131,10 +122,8 @@ var pprofBlockCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }
@ -149,10 +138,8 @@ var pprofThreadcreateCommand = cli.Command{
return err return err
} }
defer output.Close() defer output.Close()
if _, err := io.Copy(os.Stdout, output); err != nil { _, err = io.Copy(os.Stdout, output)
return err return err
}
return nil
}, },
} }

View file

@ -58,10 +58,7 @@ var fetchObjectCommand = cli.Command{
} }
defer rc.Close() defer rc.Close()
if _, err := io.Copy(os.Stdout, rc); err != nil { _, err = io.Copy(os.Stdout, rc)
return err return err
}
return nil
}, },
} }

View file

@ -57,10 +57,7 @@ func RemoveAll(name string) Applier {
func CreateDir(name string, perm os.FileMode) Applier { func CreateDir(name string, perm os.FileMode) Applier {
return applyFn(func(root string) error { return applyFn(func(root string) error {
fullPath := filepath.Join(root, name) fullPath := filepath.Join(root, name)
if err := os.MkdirAll(fullPath, perm); err != nil { return os.MkdirAll(fullPath, perm)
return err
}
return nil
}) })
} }