cargo code some defers

master
nate smith 2019-09-09 15:33:50 -05:00
parent 055d64acef
commit a49f0f6a46
1 changed files with 3 additions and 0 deletions

View File

@ -177,6 +177,8 @@ func detectDefaultPageFor(username string, defaultHTML []byte) bool {
if err != nil { if err != nil {
return false return false
} }
defer indexFile.Close()
indexHTML, err := ioutil.ReadAll(indexFile) indexHTML, err := ioutil.ReadAll(indexFile)
if err != nil { if err != nil {
return false return false
@ -194,6 +196,7 @@ func getDefaultHTML() []byte {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
defer defaultIndexFile.Close()
defaultIndexHTML, err := ioutil.ReadAll(defaultIndexFile) defaultIndexHTML, err := ioutil.ReadAll(defaultIndexFile)
if err != nil { if err != nil {