mirror of
https://github.com/restic/rest-server.git
synced 2026-09-26 05:51:24 -07:00
build.go: Fix ineffassign mistakes
https://github.com/restic/restic/commit/971ecee17118344e5d09751cb112deff7d0f8513
This commit is contained in:
@@ -125,6 +125,7 @@ func copyFile(dst, src string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer fsrc.Close()
|
||||||
|
|
||||||
if err = os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
|
if err = os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
|
||||||
fmt.Printf("MkdirAll(%v)\n", filepath.Dir(dst))
|
fmt.Printf("MkdirAll(%v)\n", filepath.Dir(dst))
|
||||||
@@ -135,28 +136,17 @@ func copyFile(dst, src string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer fdst.Close()
|
||||||
|
|
||||||
if _, err = io.Copy(fdst, fsrc); err != nil {
|
_, err = io.Copy(fdst, fsrc)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
err = fsrc.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
err = fdst.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = os.Chmod(dst, fi.Mode())
|
err = os.Chmod(dst, fi.Mode())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = os.Chtimes(dst, fi.ModTime(), fi.ModTime())
|
err = os.Chtimes(dst, fi.ModTime(), fi.ModTime())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// die prints the message with fmt.Fprintf() to stderr and exits with an error
|
// die prints the message with fmt.Fprintf() to stderr and exits with an error
|
||||||
|
|||||||
Reference in New Issue
Block a user