From bf6f61cc690978bcad416ace8e8da2418602cbf3 Mon Sep 17 00:00:00 2001 From: Gabriel Jackson Date: Sun, 29 Jan 2017 12:13:57 -0800 Subject: Cleanup log messaging This change corrects a few logging issues: * Standardized formatting errors with '%v'. * Standardized failure warning word usage. * Corrected an instance of using the standard log library when the gitea log library should be used instead. --- cmd/cert.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmd/cert.go') diff --git a/cmd/cert.go b/cmd/cert.go index df38513d6b..d9e9e366bb 100644 --- a/cmd/cert.go +++ b/cmd/cert.go @@ -82,7 +82,7 @@ func pemBlockForKey(priv interface{}) *pem.Block { case *ecdsa.PrivateKey: b, err := x509.MarshalECPrivateKey(k) if err != nil { - log.Fatalf("Unable to marshal ECDSA private key: %v\n", err) + log.Fatalf("Unable to marshal ECDSA private key: %v", err) } return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} default: @@ -112,7 +112,7 @@ func runCert(ctx *cli.Context) error { log.Fatalf("Unrecognized elliptic curve: %q", ctx.String("ecdsa-curve")) } if err != nil { - log.Fatalf("Failed to generate private key: %s", err) + log.Fatalf("Failed to generate private key: %v", err) } var notBefore time.Time @@ -121,7 +121,7 @@ func runCert(ctx *cli.Context) error { } else { notBefore, err = time.Parse("Jan 2 15:04:05 2006", ctx.String("start-date")) if err != nil { - log.Fatalf("Failed to parse creation date: %s", err) + log.Fatalf("Failed to parse creation date: %v", err) } } @@ -130,7 +130,7 @@ func runCert(ctx *cli.Context) error { serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { - log.Fatalf("Failed to generate serial number: %s", err) + log.Fatalf("Failed to generate serial number: %v", err) } template := x509.Certificate{ @@ -163,12 +163,12 @@ func runCert(ctx *cli.Context) error { derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) if err != nil { - log.Fatalf("Failed to create certificate: %s", err) + log.Fatalf("Failed to create certificate: %v", err) } certOut, err := os.Create("cert.pem") if err != nil { - log.Fatalf("Failed to open cert.pem for writing: %s", err) + log.Fatalf("Failed to open cert.pem for writing: %v", err) } pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) certOut.Close() @@ -176,7 +176,7 @@ func runCert(ctx *cli.Context) error { keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { - log.Fatalf("Failed to open key.pem for writing: %v\n", err) + log.Fatalf("Failed to open key.pem for writing: %v", err) } pem.Encode(keyOut, pemBlockForKey(priv)) keyOut.Close() -- cgit v1.2.3