Correct fprintf confusion

This commit is contained in:
Laurence Withers 2024-04-23 16:30:38 +01:00
parent aa0703da01
commit 2b5c6f1c73
2 changed files with 4 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -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)
}
}