Dark Sky API client in Go https://darksky.net/dev/docs
DarkSky's technology has been integrated into Apple Weather. I've started a separate project go-weatherkit for Go client development against Apple's new WeatherKit REST API.
This assumes you already have a working Go environment, if not please see this page first.
go get github.com/shawntoffel/darksky
Import the package into your project.
import "github.com/shawntoffel/darksky"
Construct a new DarkSky client
client := darksky.New("api key")
Build a request
request := darksky.ForecastRequest{
Latitude: 40.7128,
Longitude: -74.0059,
Options: darksky.ForecastRequestOptions{
Exclude: "hourly,minutely",
},
}
Get the forecast
forecast, err := client.Forecast(request)
A different API URL may be targeted using the BaseUrl
package scoped variable
darksky.BaseUrl = "https://api.darksky.net/forecast"