summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-02-10 12:10:11 +0000
committerNick White <git@njw.name>2020-02-10 12:10:11 +0000
commitadd4f53b087613f1cb4178cf9bf94fae96d888a4 (patch)
treebda673cdf2e313ba8d672dc450468da4aa4245b1
parentd3ce8ad60c147deca4d8d373c477ddb89b4f53a3 (diff)
downloadweather-add4f53b087613f1cb4178cf9bf94fae96d888a4.tar.bz2
weather-add4f53b087613f1cb4178cf9bf94fae96d888a4.zip
Make check for description better
-rw-r--r--weather.go4
1 files 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)