From 16f38a99294c6d19876ca083c91c78a2dd11983c Mon Sep 17 00:00:00 2001 From: Christian Zangl <laktak@cdak.net> Date: Mon, 19 Aug 2024 20:42:42 +0200 Subject: [PATCH] refactor --- cmd/chkbit/main.go | 8 ++++---- cmd/chkbit/{rate_calc.go => util/ratecalc.go} | 2 +- index.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename cmd/chkbit/{rate_calc.go => util/ratecalc.go} (98%) diff --git a/cmd/chkbit/main.go b/cmd/chkbit/main.go index c2a908a..931d1e0 100644 --- a/cmd/chkbit/main.go +++ b/cmd/chkbit/main.go @@ -72,8 +72,8 @@ type Main struct { progress Progress total int termWidth int - fps *RateCalc - bps *RateCalc + fps *util.RateCalc + bps *util.RateCalc } func (m *Main) log(text string) { @@ -331,8 +331,8 @@ func main() { m := &Main{ logger: log.New(io.Discard, "", 0), termWidth: termWidth, - fps: NewRateCalc(time.Second, (termWidth-70)/2), - bps: NewRateCalc(time.Second, (termWidth-70)/2), + fps: util.NewRateCalc(time.Second, (termWidth-70)/2), + bps: util.NewRateCalc(time.Second, (termWidth-70)/2), } m.run() } diff --git a/cmd/chkbit/rate_calc.go b/cmd/chkbit/util/ratecalc.go similarity index 98% rename from cmd/chkbit/rate_calc.go rename to cmd/chkbit/util/ratecalc.go index de25543..155384e 100644 --- a/cmd/chkbit/rate_calc.go +++ b/cmd/chkbit/util/ratecalc.go @@ -1,4 +1,4 @@ -package main +package util import ( "time" diff --git a/index.go b/index.go index 24f0ccc..cb4a24d 100644 --- a/index.go +++ b/index.go @@ -225,7 +225,7 @@ func (i *Index) load() error { } text := data.IdxRaw if data.IdxHash != HashMd5(text) { - // old versions may have save the JSON encoded with extra spaces + // old versions may have saved the JSON encoded with extra spaces text, _ = json.Marshal(data.IdxRaw) } else { }