aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-01-15 06:55:13 +0100
committerGibheer <gibheer@gmail.com>2015-01-15 06:55:13 +0100
commiteda483d0d115dfbd96413cf952ab1c58e6665ff5 (patch)
tree279f1ed5b38129521fc0b4991f9090fc1ab8fa10
parent7097d3b058faceabcfd33c7a024b779169d2a307 (diff)
fix typo and missing file close
-rw-r--r--public_key.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/public_key.go b/public_key.go
index fc1ea23..815ba7b 100644
--- a/public_key.go
+++ b/public_key.go
@@ -25,6 +25,8 @@ func create_public_key() {
if err != nil {
crash_with_help(2, fmt.Sprintf("Error when creating file %s: %s", flags.Output, err))
}
+ defer flags.output_stream.Close()
+
priv_key := load_private_key(flags.PrivateKeyPath)
marshal, err := x509.MarshalPKIXPublicKey(priv_key.Public())
if err != nil {
@@ -39,7 +41,7 @@ func parse_public_key_flags() PublicKeyFlags {
flags := PublicKeyFlags{}
fs := flag.NewFlagSet("create-public", flag.ExitOnError)
fs.StringVar(&flags.PrivateKeyPath, "private-key", "", "path to the private key file")
- fs.StringVar(&flags.Output, "output", "STDOUT", "path where the generated csr should be stored")
+ fs.StringVar(&flags.Output, "output", "STDOUT", "path where the generated public key should be stored")
fs.Parse(os.Args[2:])
return flags