aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/cert.go
diff options
context:
space:
mode:
authorGabriel Jackson <gabriel@coffeepowered.co>2017-01-29 12:13:57 -0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-02-02 15:24:18 +0100
commitbf6f61cc690978bcad416ace8e8da2418602cbf3 (patch)
tree98be4a5abcd53063b41676772b8dd37a47621c44 /cmd/cert.go
parent73d05a51e3dce4a5b31b8660a6141a14ae615404 (diff)
downloadgitea-bf6f61cc690978bcad416ace8e8da2418602cbf3.tar.gz
gitea-bf6f61cc690978bcad416ace8e8da2418602cbf3.zip
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.
Diffstat (limited to 'cmd/cert.go')
-rw-r--r--cmd/cert.go14
1 files changed, 7 insertions, 7 deletions
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()