From 7f3c9eb7499d3e96618561cf710b214dca862668 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 5 Jun 2026 16:39:50 +0200 Subject: [PATCH] data: unexport fixTime --- internal/data/node.go | 10 +++++----- internal/data/node_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/data/node.go b/internal/data/node.go index 96cfa001a..f497874b0 100644 --- a/internal/data/node.go +++ b/internal/data/node.go @@ -154,11 +154,11 @@ func (node Node) GetExtendedAttribute(a string) []byte { return nil } -// FixTime returns a time.Time which can safely be used to marshal as JSON. If +// fixTime returns a time.Time which can safely be used to marshal as JSON. If // the timestamp is earlier than year zero, the year is set to zero. In the same // way, if the year is larger than 9999, the year is set to 9999. Other than // the year nothing is changed. -func FixTime(t time.Time) time.Time { +func fixTime(t time.Time) time.Time { switch { case t.Year() < 0000: return t.AddDate(-t.Year(), 0, 0) @@ -172,9 +172,9 @@ func FixTime(t time.Time) time.Time { func (node Node) MarshalJSON() ([]byte, error) { // make sure invalid timestamps for mtime and atime are converted to // something we can actually save. - node.ModTime = FixTime(node.ModTime) - node.AccessTime = FixTime(node.AccessTime) - node.ChangeTime = FixTime(node.ChangeTime) + node.ModTime = fixTime(node.ModTime) + node.AccessTime = fixTime(node.AccessTime) + node.ChangeTime = fixTime(node.ChangeTime) type nodeJSON Node nj := nodeJSON(node) diff --git a/internal/data/node_test.go b/internal/data/node_test.go index f1b651efe..06a527cfd 100644 --- a/internal/data/node_test.go +++ b/internal/data/node_test.go @@ -51,7 +51,7 @@ func TestFixTime(t *testing.T) { for _, test := range tests { t.Run("", func(t *testing.T) { - res := FixTime(test.src) + res := fixTime(test.src) if !res.Equal(test.want) { t.Fatalf("wrong result for %v, want:\n %v\ngot:\n %v", test.src, test.want, res) }