From ba82bbd09674fc89cd55210210f6c21c30ef0fab Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Fri, 23 Dec 2022 17:02:39 +0100 Subject: [PATCH] Fix wastedassign findings --- internal/view/v1/format.go | 6 ++---- internal/view/v1/view1.go | 8 ++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/view/v1/format.go b/internal/view/v1/format.go index 7a4edb2..d44978e 100644 --- a/internal/view/v1/format.go +++ b/internal/view/v1/format.go @@ -29,7 +29,7 @@ var windDir = map[string]string{ func formatTemp(c cond) string { color := func(temp int, explicitPlus bool) string { - col := 0 + var col int if !config.Inverse { // Extemely cold temperature must be shown with violet // because dark blue is too dark @@ -233,12 +233,10 @@ func formatWind(c cond) string { } } - - hyphen := " - " // if (config.Lang == "sl") { // hyphen = "-" // } - hyphen = "-" + hyphen := "-" cWindGustKmph := color(c.WindGustKmph) cWindspeedKmph := color(c.WindspeedKmph) diff --git a/internal/view/v1/view1.go b/internal/view/v1/view1.go index 3a5aac0..9cc98e6 100644 --- a/internal/view/v1/view1.go +++ b/internal/view/v1/view1.go @@ -10,6 +10,11 @@ import ( var slotTimes = [slotcount]int{9 * 60, 12 * 60, 18 * 60, 22 * 60} func printDay(w weather) (ret []string) { + var ( + dateName string + names string + ) + hourly := w.Hourly ret = make([]string, 5) for i := range ret { @@ -53,7 +58,7 @@ func printDay(w weather) (ret []string) { } else { lctime.SetLocale("en_US") } - dateName := "" + if config.RightToLeft { dow := lctime.Strftime("%a", d) day := lctime.Strftime("%d", d) @@ -102,7 +107,6 @@ func printDay(w weather) (ret []string) { "└──────────────────────────────┴──────────────────────────────┘") } - names := "" if config.RightToLeft { names = "│" + justifyCenter(trans[3], 29) + "│ " + justifyCenter(trans[2], 16) + "└──────┬──────┘" + justifyCenter(trans[1], 16) + " │" + justifyCenter(trans[0], 29) + "│"