Golang定时器

func main(){
    timerAction()
}

func timerAction(){
    time.AfterFunc(10*time.Second,timerAction)
    println("do something")
}

简单明了,10秒执行一次

你可能感兴趣的:(golang,开发语言,后端)