Close file

This commit is contained in:
CallanTaylor 2019-11-12 11:38:55 +13:00
parent 12cc53d699
commit 8affab1a2b

View File

@ -55,6 +55,7 @@ func ReadFile(file string) (content string, err error) {
if err != nil { if err != nil {
return content, err return content, err
} }
defer file.Close()
buf, err := ioutil.ReadAll(file) buf, err := ioutil.ReadAll(file)
if err != nil { if err != nil {
return content, err return content, err
@ -65,6 +66,7 @@ func ReadFile(file string) (content string, err error) {
if err != nil { if err != nil {
return content, err return content, err
} }
defer file.Close()
buf, err := ioutil.ReadAll(file) buf, err := ioutil.ReadAll(file)
if err != nil { if err != nil {
return content, err return content, err