From add4f53b087613f1cb4178cf9bf94fae96d888a4 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 10 Feb 2020 12:10:11 +0000 Subject: Make check for description better --- weather.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weather.go b/weather.go index c421f68..65862f3 100644 --- a/weather.go +++ b/weather.go @@ -237,8 +237,8 @@ func main() { for _, w := range weather { fmt.Printf("%s %s ", w.date, w.time) - desc := TypeDescription[w.weathertype] - if desc == "" { + desc, ok := TypeDescription[w.weathertype] + if !ok { desc = fmt.Sprintf("%d", w.weathertype) } fmt.Printf("%18s, Temp: %4.1f°C, ", desc, w.temperature) -- cgit v1.2.3