func GraphUpdater(dc *gg.Context) { ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() for { select { case job := <-Queue: intVal, _ := strconv.Atoi(job) dc.DrawCircle(float64(TimerVal), float64(1000-(intVal)), 5) dc.Fill() dc.SavePNG("out.png") if TimerVal >= 1000 { TimerVal = 0 dc.Clear() } case <-ticker.C: TimerVal = TimerVal + 1 } } }