diff --git a/dispatcher.go b/dispatcher.go index 53f62cb..f86439a 100644 --- a/dispatcher.go +++ b/dispatcher.go @@ -56,10 +56,9 @@ func NewDispatcher(forecasters map[string]source.Forecaster, configService *Conf forecasters: forecasters, scheduler: scheduler, configService: configService, - // todo: understand buffered channels. - requests: make(chan Request, 10), - results: make(chan Result, 10), - awaiting: make(map[CacheKey]*[]Request), + requests: make(chan Request, 10), + results: make(chan Result, 10), + awaiting: make(map[CacheKey]*[]Request), } go d.runLoop() return d diff --git a/internal/convert/convert.go b/internal/convert/convert.go index c601ff4..75c3b7c 100644 --- a/internal/convert/convert.go +++ b/internal/convert/convert.go @@ -1,9 +1,7 @@ package convert import ( - "fmt" "math" - "strconv" ) func CToF(celsius float64) float64 { @@ -45,12 +43,3 @@ func NilToZero(a *float64) *float64 { } return a } - -func StrToF(s string, msg string) float64 { - v, err := strconv.ParseFloat(s, 64) - if err != nil { - fmt.Printf("Unable to parse %s value '%s'\n", msg, s) - v = 0 - } - return v -} diff --git a/main.go b/main.go index 522f5a1..b7f76df 100644 --- a/main.go +++ b/main.go @@ -16,9 +16,9 @@ import ( ) var ( - version string = "development" - goVersion string = "unknown" - buildDate string = "unknown" + version = "development" + goVersion = "unknown" + buildDate = "unknown" ) func main() { @@ -106,4 +106,3 @@ func MakeForecasters(enabled []string, cacheDir string, vcKey string) map[string // todo // update readme -// allow http server functionality to be turned off if desired, by not including a port to listen on or something diff --git a/scheduler.go b/scheduler.go index 17485b1..c85c14e 100644 --- a/scheduler.go +++ b/scheduler.go @@ -25,7 +25,7 @@ func (s Scheduler) Start() { // run loops and calls updateForecasts at the top of each hour. func (s Scheduler) run() { firstRun := time.Now().Truncate(time.Hour) - for _ = range kronika.Every(context.Background(), firstRun, time.Hour) { + for range kronika.Every(context.Background(), firstRun, time.Hour) { s.updateForecasts() } } diff --git a/server.go b/server.go index 601ea6f..80e342d 100644 --- a/server.go +++ b/server.go @@ -162,12 +162,8 @@ func (s *Server) ParseParams(Form url.Values) (*Params, error) { if err != nil { return nil, err } - // fixme: - // error start, _ := strconv.ParseInt(Form.Get("start"), 10, 64) end, _ := strconv.ParseInt(Form.Get("end"), 10, 64) - // fixme: - // error step, _ := strconv.ParseInt(Form.Get("step"), 10, 64) return &Params{ Start: start, diff --git a/source/visualcrossing.go b/source/visualcrossing.go index 57ea471..0a6045f 100644 --- a/source/visualcrossing.go +++ b/source/visualcrossing.go @@ -27,7 +27,7 @@ func (v *VisualCrossing) GetForecast(lat string, lon string) (*Forecast, error) q.Add("contentType", "json") q.Add("unitGroup", "us") q.Add("locationMode", "single") - q.Add("key", v.Key) // todo + q.Add("key", v.Key) q.Add("location", lat+","+lon) q.Add("includeAstronomy", "true") off := backoff.NewExponentialBackOff()