Weather Forecast Application 🌤️
A simple Go application that fetches and displays the current weather conditions and forecast for a specified city using the WeatherAPI.
Build Status

Features
- Fetches current weather conditions.
- Displays a weather forecast for a specified number of days.
- Color-coded output based on weather conditions.
Getting Started
Prerequisites
- Go 1.16 or later
- A WeatherAPI access token
- A
.env file with the following variables:
- Obtain a free API key from WeatherAPI.
WEATHER_ACCESS_TOKEN=your_weather_api_token
DEFAULT_LOCATION=your_default_city
NO_OF_DAYS=number_of_days_to_forecast
Installation
-
Clone the repository:
git clone https://github.com/jvanrhyn/sun.git
cd sun
-
Install dependencies:
go mod tidy
Usage
-
Run the application:
go run main.go
-
You can specify the city and number of days to forecast using command-line flags:
go run main.go -city="New York" -days=3
Example Output
New York, United States
Current Conditions
25°c, Partly cloudy. 10% chance of rain
wind 15km/h, gusts 20km/h
Forecast:
2023-10-01
15:00 | 22°c | Clear | 0% rain | wind 10(15) km/h
16:00 | 23°c | Clear | 0% rain | wind 12(18) km/h
...
Contributing
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch).
- Make your changes.
- Commit your changes (
git commit -am 'Add new feature').
- Push to the branch (
git push origin feature-branch).
- Create a new Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.