Skip to content

Commit ffc9583

Browse files
author
Shlomi Noach
authored
Merge pull request #586 from SchumacherFM/fClose-Fix
go/base: Do not ignore f.Close error
2 parents 4b1b70d + ef28068 commit ffc9583

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

go/base/utils.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ func FileExists(fileName string) bool {
4040
func TouchFile(fileName string) error {
4141
f, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE, 0755)
4242
if err != nil {
43-
return (err)
43+
return err
4444
}
45-
defer f.Close()
46-
return nil
45+
return f.Close()
4746
}
4847

4948
// StringContainsAll returns true if `s` contains all non empty given `substrings`

0 commit comments

Comments
 (0)