Some checks failed
check / check (push) Has been cancelled
Adopts golangci-lint v2.12.2 and the canonical .golangci.yml (default: all), and fixes all resulting findings across the tree. Two intended behavior changes: absent MFFilePath.Mtime is handled explicitly in freshen, list and export rather than dereferenced (main panicked); gpg positional key IDs now follow an explicit -- end-of-options marker. All twelve reworded user-visible error messages restored to byte-identical parity with main and pinned by tests.
29 lines
864 B
Go
29 lines
864 B
Go
package cli
|
|
|
|
import (
|
|
"time"
|
|
|
|
"sneak.berlin/go/mfer/mfer"
|
|
)
|
|
|
|
// mtimeAbsent is printed in place of a modification time when a manifest
|
|
// entry does not carry one.
|
|
const mtimeAbsent = "-"
|
|
|
|
// entryMtime returns the modification time recorded for a manifest entry.
|
|
//
|
|
// MFFilePath.Mtime is a message pointer with proto3 field presence, so an
|
|
// absent mtime is a representable, on-the-wire-valid state. It must never
|
|
// be conflated with a recorded mtime of the Unix epoch: callers that
|
|
// compare mtimes have to treat "absent" as "unknown", not as
|
|
// 1970-01-01T00:00:00Z, or every entry compares as modified. ok reports
|
|
// whether an mtime was actually recorded.
|
|
func entryMtime(entry *mfer.MFFilePath) (time.Time, bool) {
|
|
ts := entry.GetMtime()
|
|
if ts == nil {
|
|
return time.Time{}, false
|
|
}
|
|
|
|
return time.Unix(ts.GetSeconds(), int64(ts.GetNanos())), true
|
|
}
|