Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Code improvements and close files that were opened
Browse files Browse the repository at this point in the history
  • Loading branch information
geauxvirtual committed Nov 23, 2015
1 parent c1ded83 commit 4183b10
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,36 +377,36 @@ func action(ctx *cli.Context) {
continue
}
if strings.HasSuffix(keyringFile.Name(), ".gpg") || (strings.HasSuffix(keyringFile.Name(), ".pub")) || (strings.HasSuffix(keyringFile.Name(), ".pubring")) {
_, err := os.Open(keyringPath)
f, err := os.Open(keyringPath)
if err != nil {
log.WithFields(
log.Fields{
"block": "main",
"_module": "pulsed",
"error": err.Error(),
"keyringPath": keyringPath,
}).Warning("can't open keyring file. not adding to keyring path")
} else {
log.Info("adding keyring file: ", keyringPath+"/"+keyringFile.Name())
c.SetKeyringFile(keyringPath + "/" + keyringFile.Name())
}).Warning("unable to open keyring file. not adding to keyring path")
continue
}
f.Close()
log.Info("adding keyring file: ", keyringPath+"/"+keyringFile.Name())
c.SetKeyringFile(keyringPath + "/" + keyringFile.Name())
}
}
} else {
_, err := os.Open(keyringPath)
f, err := os.Open(keyringPath)
if err != nil {
log.WithFields(
log.Fields{
"block": "main",
"_module": "pulsed",
"error": err.Error(),
"keyringPath": keyringPath,
}).Warning("can't open keyring file. not adding to keyring path")
os.Exit(1)
} else {
log.Info("adding keyring file ", keyringPath)
c.SetKeyringFile(keyringPath)
}).Fatal("unable to open keyring file.")
}
f.Close()
log.Info("adding keyring file ", keyringPath)
c.SetKeyringFile(keyringPath)
}
}
}
Expand Down

0 comments on commit 4183b10

Please sign in to comment.