refactor: refactoring of code to meet all go lint requirements

This commit is contained in:
Jonas Kaninda
2024-12-06 16:25:16 +01:00
parent 2bcfd3aacf
commit 793b04340e
10 changed files with 141 additions and 17 deletions

View File

@@ -116,7 +116,12 @@ func copyFile(src, dst string) error {
if err != nil {
return err
}
defer in.Close()
defer func(in *os.File) {
err := in.Close()
if err != nil {
return
}
}(in)
out, err := os.Create(dst)
if err != nil {
@@ -125,7 +130,10 @@ func copyFile(src, dst string) error {
_, err = io.Copy(out, in)
if err != nil {
out.Close()
err := out.Close()
if err != nil {
return err
}
return err
}
return out.Close()