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
}
if err := syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor))); err != nil {
return err
}
return nil
return syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor)))
}
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error {

View file

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

View file

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

View file

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