Written by ChatGPT but looks accurate
This GoLang application provides real-time weather information based on user-provided location data. It leverages the Mapbox Geocoding API to convert a user's address input into geographical coordinates (latitude and longitude). The obtained coordinates are then used to fetch weather data from the OpenWeatherMap API.
Before running the application, ensure you have the following:
- Go installed on your machine.
- Access to Mapbox API and OpenWeatherMap API keys. Set these keys as environment variables:
- Mapbox API Key:
MapBoxAPI - OpenWeatherMap API Key:
OpenWeatherAPI
- Mapbox API Key:
-
Clone the repository:
git clone https://github.com/your_username/your_repo.git cd your_repo -
Set up environment variables:
export MapBoxAPI=your_mapbox_api_key export OpenWeatherAPI=your_openweather_api_key
-
Run the application:
go run main.go
-
The application will prompt you to enter your location.
-
Provide your address as input when prompted.
-
The application will display the current temperature and weather description for the specified location.
main.go: Contains the main logic for user interaction, geocoding, and weather data retrieval.
- Mapbox and OpenWeatherMap for providing the APIs used in this application.