diff --git a/cmd/location.go b/cmd/location.go index bee23a0..e889439 100644 --- a/cmd/location.go +++ b/cmd/location.go @@ -12,7 +12,7 @@ import ( ) // Use WAN address to obtain location data -func getLocation(app *application) { +func getLocation(app *Application) { res, err := http.Get("https://ipinfo.io/json") if err != nil { @@ -37,7 +37,7 @@ func getLocation(app *application) { } // Prompt user for location -func getPreciseLocation(app *application) { +func getPreciseLocation(app *Application) { fmt.Print("\nEnter latitude: ") diff --git a/cmd/main.go b/cmd/main.go index 58b8e76..35e5df3 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( const version string = "0.2.0" -type weatherMain struct { +type Weather struct { Temp float32 `json:"temp"` FeelsLike float32 `json:"feels_like"` HighTemp float32 `json:"temp_max"` @@ -21,18 +21,18 @@ type weatherMain struct { Humidity uint `json:"humidity"` } -type weatherWind struct { +type Wind struct { Speed float32 `json:"speed"` Gust float32 `json:"gust"` } -type forecast struct { +type Forecast struct { //Overview weatherOverview `json:"weather"` - Main weatherMain `json:"main"` - Wind weatherWind `json:"wind"` + Main Weather `json:"main"` + Wind Wind `json:"wind"` } -type config struct { +type Config struct { Units string `json:"units"` Location string `json:"loc"` Longitude string `json:"lat"` @@ -40,9 +40,9 @@ type config struct { ApiKey string `json:"appid"` } -type application struct { - Forecast forecast - Config config +type Application struct { + Forecast Forecast + Config Config Version string Client pb.RouteGuideClient } @@ -62,14 +62,14 @@ func main() { } // Read API_KEY from .env and create app - cfg := config{ + cfg := Config{ Units: "imperial", ApiKey: os.Getenv("API_KEY"), } - fcst := forecast{} + fcst := Forecast{} - app := application{ + app := Application{ Config: cfg, Forecast: fcst, Version: version, diff --git a/cmd/menu.go b/cmd/menu.go index 37de86c..5ef0455 100644 --- a/cmd/menu.go +++ b/cmd/menu.go @@ -8,7 +8,7 @@ import ( "strings" ) -func mainMenu(app *application) { +func mainMenu(app *Application) { // Display main menu fmt.Println("\n=====================================================") diff --git a/cmd/render.go b/cmd/render.go index a17e85f..be36e0e 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -3,7 +3,7 @@ package main import "fmt" // Prints saved weather data to the terminal -func printWeather(app *application) { +func printWeather(app *Application) { var unitStr string if app.Config.Units == "imperial" { diff --git a/cmd/weather.go b/cmd/weather.go index 8e9dab4..71491c7 100644 --- a/cmd/weather.go +++ b/cmd/weather.go @@ -8,7 +8,7 @@ import ( ) // Get and store the current forecast -func getCurrent(app *application) { +func getCurrent(app *Application) { lat := "lat=" + app.Config.Latitude lon := "&lon=" + app.Config.Longitude