Adding to @Adrians Comments,
The package robfig/cron supports cron expression format. To have the cron run 30 mins past every hour viz on 9:30 am,10:30 am, 11:30 am. You could use
c.AddFunc("0 30 * * * *", func() {})
an implementation to have the cron run after Sep 1, 2017
package main
import (
"fmt"
"time"
"github.com/robfig/cron"
)
func main() {
// time set to Sep 1, 2017 00:00 Hours UTC
t := time.Date(2017, time.September, 1, 0, 0, 0, 0, time.UTC)
c := cron.New()
//using cron expression format to have the function run every hour on the half hour
c.AddFunc("0 30 * * * *", func() {
if time.Now.After(t){
fmt.Println("yay")
//insert logic block
}
})
}
Note: The cron expression format used by this package is different from the standard unix cron format. The expression format used by this package allows for second precision unlike unix cron format.