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

@@ -45,7 +45,12 @@ func createFile(fileName, content string) ([]byte, error) {
fmt.Println("Error creating file:", err)
return nil, err
}
defer file.Close()
defer func(file *os.File) {
err := file.Close()
if err != nil {
return
}
}(file)
// Write the message to the file
_, err = file.WriteString(content)