You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
owm "github.com/briandowns/openweathermap"
"log"
)
func main() {
w, err := owm.NewCurrent("C", "en", "<redacted>")
if err != nil {
log.Fatal(err)
}
err = w.CurrentByName("St Petersburg")
if err != nil {
log.Fatal(err)
}
log.Printf("Temperature in %s: %.1f °C\n", w.Name, w.Main.Temp)
err = w.CurrentByName("fff")
if err != nil {
log.Fatal(err)
}
log.Printf("Temperature in %s: %.1f °C\n", w.Name, w.Main.Temp)
}
This outputs json: cannot unmarshal string into Go struct field CurrentWeatherData.cod of type int as an error for the second CurrentByName call.
Perhaps a more descriptive error message could be used here?
The text was updated successfully, but these errors were encountered:
Consider the following example;
This outputs
json: cannot unmarshal string into Go struct field CurrentWeatherData.cod of type int
as an error for the second CurrentByName call.Perhaps a more descriptive error message could be used here?
The text was updated successfully, but these errors were encountered: