From ff020e36fb3faa70c25762809050c08cf740bc19 Mon Sep 17 00:00:00 2001 From: davidprogers <34503507+davidprogers@users.noreply.github.com> Date: Sat, 16 Dec 2017 21:40:17 -0800 Subject: [PATCH 1/2] Add API Key query to examples --- _examples/cli/weather.go | 2 +- _examples/web/weatherweb.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/_examples/cli/weather.go b/_examples/cli/weather.go index a6db674..9315d97 100644 --- a/_examples/cli/weather.go +++ b/_examples/cli/weather.go @@ -104,7 +104,7 @@ func getLocation() *Data { // getCurrent gets the current weather for the provided // location in the units provided. func getCurrent(l, u, lang string) *owm.CurrentWeatherData { - w, err := owm.NewCurrent(u, lang) + w, err := owm.NewCurrent(u, lang, os.Getenv("OWM_API_KEY")) if err != nil { log.Fatalln(err) } diff --git a/_examples/web/weatherweb.go b/_examples/web/weatherweb.go index f54aac2..9cb5152 100644 --- a/_examples/web/weatherweb.go +++ b/_examples/web/weatherweb.go @@ -11,6 +11,7 @@ package main import ( "encoding/json" "html/template" + "os" owm "github.com/briandowns/openweathermap" // "io/ioutil" @@ -59,7 +60,7 @@ func getLocation() (*Data, error) { // getCurrent gets the current weather for the provided location in // the units provided. func getCurrent(l, u, lang string) *owm.CurrentWeatherData { - w, err := owm.NewCurrent(u, lang) // Create the instance with the given unit + w, err := owm.NewCurrent(u, lang, os.Getenv("OWM_API_KEY")) // Create the instance with the given unit if err != nil { log.Fatal(err) } From e6a357557dc42e8f703bed17acd61029b6034436 Mon Sep 17 00:00:00 2001 From: davidprogers <34503507+davidprogers@users.noreply.github.com> Date: Sat, 16 Dec 2017 21:44:04 -0800 Subject: [PATCH 2/2] Reorder imports --- _examples/web/weatherweb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_examples/web/weatherweb.go b/_examples/web/weatherweb.go index 9cb5152..5411c74 100644 --- a/_examples/web/weatherweb.go +++ b/_examples/web/weatherweb.go @@ -11,12 +11,12 @@ package main import ( "encoding/json" "html/template" - "os" owm "github.com/briandowns/openweathermap" // "io/ioutil" "log" "net/http" + "os" ) // URL is a constant that contains where to find the IP locale info