From 0e2d1c42c9b56e2676603aefe2dafdefa32b3d3a Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 10 Feb 2020 12:06:45 +0000 Subject: Show weather code if no description is known --- weather.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weather.go b/weather.go index cb6128d..237b707 100644 --- a/weather.go +++ b/weather.go @@ -236,7 +236,11 @@ func main() { for _, w := range weather { fmt.Printf("%s %s ", w.date, w.time) - fmt.Printf("%18s, Temp: %4.1f°C, ", TypeDescription[w.weathertype], w.temperature) + desc := TypeDescription[w.weathertype] + if desc == "" { + desc = fmt.Sprintf("%d", w.weathertype) + } + fmt.Printf("%18s, Temp: %4.1f°C, ", desc, w.temperature) fmt.Printf("Rain: %2d%%, Wind: %4.1fmph\n", w.precipitation, w.windspeed) if *verbose { fmt.Printf(" %+v\n", w) -- cgit v1.2.3