
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
github.com/qba73/meteo
Meteo is a Go client library for the weather and meteorological forecast from Yr.
Weather forecast from Yr, delivered by the Norwegian Meteorological Institute and NRK.
You must register your user agent string in the YR.NO service and your user name at the GeoNames.org.
package main
import (
"fmt"
"github.com/qba73/meteo"
)
func main() {
// Export GEO_USERNAME Env Var (you registered at geonames.org)
// Get current weather for given location.
weather, err := meteo.GetWeather("Vilnius,LT")
if err != nil {
fmt.Println(err)
}
fmt.Println(weather)
// Cloudy 4.2°C
fmt.Println(weather.Summary)
// cloudy
fmt.Println(weather.Temp)
// 4.2
}
The code sample below shows a basic example of how the meteo package can fetch weather statuses concurrently.
package main
import (
"fmt"
"time"
"github.com/qba73/meteo"
)
func main() {
start := time.Now()
ch := make(chan string)
locations := []string{
"Vilnius,LT", "Dublin,IE", "London,UK", "Berlin,DE",
"Belfast,UK", "Castlebar,IE", "Killarney,IE",
"Warsaw,PL", "Lodz,PL", "Vienna,AT"}
for _, loc := range locations {
go getWeather(loc, ch)
}
for range locations {
fmt.Println(<-ch)
}
fmt.Printf("%.2fs elapsed\n", time.Since(start).Seconds())
}
func getWeather(location string, ch chan<- string) {
start := time.Now()
weather, err := meteo.GetWeather(location)
if err != nil {
ch <- fmt.Sprint(err)
return
}
sec := time.Since(start).Seconds()
ch <- fmt.Sprintf("%.2fs Location: %s, Weather: %s", sec, location, weather)
}
$ go install github.com/qba73/meteo/cmd/meteo@latest
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.