It looks like gocron.Start() runs the jobs in another goroutine, so you can just do both things in your main function:
func main() { s := gocron.NewScheduler() s.Every(3).Seconds().Do(task) stopper := s.Start() defer close(stopper) err := http.ListenAndServe(":5000", nil) if err != nil { log.Fatalln(err) } } On Wednesday, September 7, 2016 at 11:43:31 AM UTC-4, Matt Davies wrote: > > Evening all > > We're writing a new app and we'd like it to do a number of things at the > same time. > > We're planning on using gocron https://github.com/jasonlvhit/gocron to > schedule grabbing some files from another source, then reformatting those > files and placing them into a folder in the app. > > That's all working fine. > > What we now need to do is serve those file up from that folder all of the > time using http.ListenAndServe. > > Am I on the right track here? > > https://tour.golang.org/concurrency/1 > > Or maybe gocron can schedule the http.ListenAndServe to run all the time? > > Any tips or advice greatly appreciated. > > > > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.