package main import ( "flag" "fmt" "log" "time" _ "github.com/influxdata/influxdb1-client" ) var wc WeatherConfig var configpath string var err error var now = time.Now() const kelvin = -273.15 func main() { flag.StringVar(&configpath, "configfile", "weather.ini", "config file to use with fuelprices section") flag.Parse() err := GetConfig(configpath, &wc) if err != nil { log.Fatal(err) } for _, city := range wc.WeatherCities { d, err := FetchData(city) if err != nil { log.Fatal(err) } err = SendToInflux(&wc, d) if err != nil { log.Fatal(err) } else { log.Println(fmt.Sprintf("Successfully sent data for %s", city)) } } }