From 2b5c6f1c73cb5a9d5a86809dbe77149a7db1c306 Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Tue, 23 Apr 2024 16:30:38 +0100 Subject: [PATCH] Correct fprintf confusion --- cmd/ca/ca.go | 4 ++-- cmd/inspect/display_structured.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/ca/ca.go b/cmd/ca/ca.go index e9f725c..b623751 100644 --- a/cmd/ca/ca.go +++ b/cmd/ca/ca.go @@ -96,7 +96,7 @@ func signingDates(defaultDuration time.Duration) (from, until time.Time) { } else { from, err = time.Parse(time.RFC3339, validFrom) if err != nil { - fmt.Fprintln(os.Stderr, "--valid-from %s: not a valid RFC3339-format timestamp\n") + fmt.Fprintf(os.Stderr, "--valid-from %q: not a valid RFC3339-format timestamp\n", validFrom) os.Exit(1) } } @@ -105,7 +105,7 @@ func signingDates(defaultDuration time.Duration) (from, until time.Time) { } else { until, err = time.Parse(time.RFC3339, validUntil) if err != nil { - fmt.Fprintln(os.Stderr, "--valid-until %s: not a valid RFC3339-format timestamp\n") + fmt.Fprintf(os.Stderr, "--valid-until %q: not a valid RFC3339-format timestamp\n", validUntil) os.Exit(1) } } diff --git a/cmd/inspect/display_structured.go b/cmd/inspect/display_structured.go index d1891a0..0b48210 100644 --- a/cmd/inspect/display_structured.go +++ b/cmd/inspect/display_structured.go @@ -28,7 +28,7 @@ func displayStructuredJSON() { enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") if err := enc.Encode(displayStructures); err != nil { - fmt.Fprintln(os.Stderr, "failed to encode as JSON: %v\n", aura.Red(err)) + fmt.Fprintf(os.Stderr, "failed to encode as JSON: %v\n", aura.Red(err)) os.Exit(1) } } @@ -37,7 +37,7 @@ func displayStructuredYAML() { enc := yaml.NewEncoder(os.Stdout) enc.SetIndent(2) if err := enc.Encode(displayStructures); err != nil { - fmt.Fprintln(os.Stderr, "failed to encode as YAML: %v\n", aura.Red(err)) + fmt.Fprintf(os.Stderr, "failed to encode as YAML: %v\n", aura.Red(err)) os.Exit(2) } }