From 1c40103fbf17c693c295fbfd3354083588f8171f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sun, 20 Jan 2019 13:43:06 -0500 Subject: [PATCH] Fix generateKey error logging This logs the actual error when it occurs, instead of always saying that the key already exists. --- keys.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keys.go b/keys.go index ccc872e..0b3d76a 100644 --- a/keys.go +++ b/keys.go @@ -73,9 +73,12 @@ func initKeys(app *app) error { // keys, this won't overwrite any existing key, and instead outputs a message. func generateKey(path string) error { // Check if key file exists - if _, err := os.Stat(path); !os.IsNotExist(err) { + if _, err := os.Stat(path); err == nil { log.Info("%s already exists. rm the file if you understand the consquences.", path) return nil + } else if !os.IsNotExist(err) { + log.Error("%s", err) + return err } log.Info("Generating %s.", path)