Skip to content

Commit

Permalink
updated compressLogFile
Browse files Browse the repository at this point in the history
  • Loading branch information
PAKalucki committed Sep 12, 2024
1 parent d45742e commit d1df0a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func compressLogFile(filePath string, compressionFormat string) error {
return nil
}
default:
return fmt.Errorf("unsupported compression format: %s", compressionFormat)
return fmt.Errorf("unsupported compression format: %s", format)

Check failure on line 141 in utils.go

View workflow job for this annotation

GitHub Actions / test

undefined: format
}

inputFile, err := os.Open(filePath)
Expand All @@ -157,6 +157,10 @@ func compressLogFile(filePath string, compressionFormat string) error {
return err
}

if err := inputFile.Close(); err != nil {
return fmt.Errorf("failed to close input file: %v", err)
}

if err := os.Remove(filePath); err != nil {
return fmt.Errorf("failed to remove original file after compression: %v", err)
}
Expand Down

0 comments on commit d1df0a9

Please sign in to comment.