R
R
Roman Rakzin2015-07-16 17:47:22
go
Roman Rakzin, 2015-07-16 17:47:22

How to run a function at a certain time in golang?

How to run a function at a certain time in golang?
I need to run myfunc function, let's say at 00:00 o'clock. How to do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2015-07-16
@alexey-m-ukolov

Looking forward to a response from the author:

Understood: you need to use cron.

S
SilentFl, 2015-07-17
@SilentFl

it is possible to manage with standard means, through time.After. Example

F
FanKiLL, 2015-07-16
@FanKiLL

import (
  "github.com/robfig/cron"
)

c := cron.New()
c.AddFunc("* * * * * ", func() { fmt.Println("Every second") })
c.Start()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question