diff --git a/pkg/analyze/encode.go b/pkg/analyze/encode.go index ee5e6351a..c9f20ff02 100644 --- a/pkg/analyze/encode.go +++ b/pkg/analyze/encode.go @@ -2,8 +2,8 @@ package analyze import ( "encoding/json" - "fmt" "io" + "strconv" ) // EncodeJSON writes JSON representation of dir @@ -24,7 +24,7 @@ func (f *Dir) EncodeJSON(writer io.Writer, topLevel bool) error { if !f.GetMtime().IsZero() { buff = append(buff, []byte(`,"mtime":`)...) - buff = append(buff, []byte(fmt.Sprint(f.GetMtime().Unix()))...) + buff = append(buff, []byte(strconv.FormatInt(f.GetMtime().Unix(), 10))...) } buff = append(buff, '}') @@ -65,15 +65,15 @@ func (f *File) EncodeJSON(writer io.Writer, topLevel bool) error { } if f.GetSize() > 0 { buff = append(buff, []byte(`,"asize":`)...) - buff = append(buff, []byte(fmt.Sprint(f.GetSize()))...) + buff = append(buff, []byte(strconv.FormatInt(f.GetSize(), 10))...) } if f.GetUsage() > 0 { buff = append(buff, []byte(`,"dsize":`)...) - buff = append(buff, []byte(fmt.Sprint(f.GetUsage()))...) + buff = append(buff, []byte(strconv.FormatInt(f.GetUsage(), 10))...) } if !f.GetMtime().IsZero() { buff = append(buff, []byte(`,"mtime":`)...) - buff = append(buff, []byte(fmt.Sprint(f.GetMtime().Unix()))...) + buff = append(buff, []byte(strconv.FormatInt(f.GetMtime().Unix(), 10))...) } if f.Flag == '@' { diff --git a/report/export.go b/report/export.go index 24285795e..0d9f22649 100644 --- a/report/export.go +++ b/report/export.go @@ -8,6 +8,7 @@ import ( "os" "runtime/debug" "sort" + "strconv" "sync" "time" @@ -97,7 +98,7 @@ func (ui *UI) AnalyzePath(path string, _ *analyze.Dir) error { buff.Write([]byte(`[1,2,{"progname":"gdu","progver":"`)) buff.Write([]byte(build.Version)) buff.Write([]byte(`","timestamp":`)) - buff.Write([]byte(fmt.Sprint(time.Now().Unix()))) + buff.Write([]byte(strconv.FormatInt(time.Now().Unix(), 10))) buff.Write([]byte("},\n")) if err = dir.EncodeJSON(&buff, true); err != nil { diff --git a/tui/show.go b/tui/show.go index 115f6525f..ca9c4d266 100644 --- a/tui/show.go +++ b/tui/show.go @@ -1,7 +1,7 @@ package tui import ( - "fmt" + "strconv" "strings" "github.com/dundee/gdu/v5/build" @@ -70,7 +70,7 @@ func (ui *UI) showDir() { " Apparent size: " + footerNumberColor + ui.formatSize(totalSize, true, false) + - " Items: " + footerNumberColor + fmt.Sprint(itemCount) + + " Items: " + footerNumberColor + strconv.Itoa(itemCount) + footerTextColor + " Sorting by: " + ui.sortBy + " " + ui.sortOrder)