One other minor point. When you write
for _ = range ticker.C {
...
}
then you have a timer leak if you break or return from that loop but don't
call ticker.Stop(). If you only ever exit by "return" from the function,
then you can simply do:
ticker := time.NewTicker(time.Duration(Timer) * time.Second)
*defer ticker.Stop()*
as per the example here <https://golang.org/pkg/time/#NewTicker>. However
since your code could never exit from that loop, it wasn't a problem (and
the outer "for { ... }" loop was unnecessary too)
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/87fcc13a-21e8-4700-b4ed-b0855505259an%40googlegroups.com.