pub fn render_go_duration(d: Duration) -> StringExpand description
Render a Duration back to a Go-style duration string, using the largest unit that
divides it exactly (21600s → "6h", 1200s → "20m", else "{n}s").
Round-trips through parse_go_duration by construction — it emits only the
single-unit grammar that function accepts. Two callers need it:
- kopia argv. Durations that reach a kopia CLI flag must never be the user’s raw
text. kopia’s
time.ParseDurationREJECTS a bare number (--epoch-min-duration=3600→time: missing unit in duration "3600") whileparse_go_durationhappily accepts one — so passing the string through would admit at the webhook and crash in the mover, breaking this module’s stated contract. Parse, then render, and the mismatch is gone. - Status mirrors. kopia reports durations as
time.Durationnanoseconds; rendering them through here is what makesstatuscomparable tospecand stable across reconciles (no"24h"vs"24h0m0s"ambiguity).