This Go application provides a command-line interface (CLI) tool for retrieving weather information for a specified location using the Weather API
-
Fetches current weather conditions and hourly forecast for a location.
-
Displays temperature, weather description, and chance of rain for upcoming hours.
-
Highlights rainy hours.
Prerequisites:
- Go should be installed on your system
Clone this repository
https://github.com/Shreyank031/go_cli-weatherApp.git
Navigate to the project directory:
cd go_cli-weatherApp
Setting up your .env
file
This weather CLI application utilizes the godotenv
package to manage the API key securely. Here's how to configure it:
-
Create a .env file: Create a file named .env in the root directory of your project (where the main.go file resides).
-
Add your API key:
Inside the .env file, add a line in the following format:
ApiKey=<your_api_key>
Replace <your_api_key> with the actual API key obtained from the Weather API website.
Download the dependencies
go mod download
Build the executable:
go build main.go
Run the application
./go_cli-weatherApp <location>
Replace <location>
with desired location name(e.g., Bengaluru, Tokyo)
Note: If you don't provide the location name, by default it will consider Bengaluru