Open marksalpeter opened 9 years ago
I ran into the same issue. A little hint would be pretty helpful.
I would fix the messages if we could agree on an useful text like:
"Use Minutes() if you want to schedule intervals > 1min "
The same issue applies to Hour() and Second().
:+1: to gocron.Every(5).Minute().Do(func () {}) being an alias of gocron.Every(5).Minutes().Do(func () {}).
If aliasing is an option I would additionally print a message that the function is misused.
@HorstMumpitz I don't think it is being misused. If you look at the standard libraries time
package every duration is defined in the singular. For example, Its common for example to do something like
fiveMinutes := 5 * time.Minute
It might make sense to remove the plurals. Any thoughts?
one thing here is that if you want to pass the number of minutes as an arg of your program you have to do something like :
switch argv[0] {
case 1: gocron.Every(argv[0]).Minute().Do(func () {})
default: gocron.Every(5).Minute*s*().Do(func () {})
}
Which is not very usefull.
as i like to keep my code as readable as possible, i would vote also at least for a clear warning about that missuse or an alias that make it work the nice way :-)
Why not just deprecate the singular and just use the plural?
gocron.Every(1).Minutes().Do(func(){})
Is still readable.
gocron.Every(5).Minute().Do(func () {}) panics with no error message, its literally an empty string. this should be equivalent to gocron.Every(5).Minutes().Do(func () {})