for {
ticker = time.NewTicker(time.Duration(timeOut) * time.Second)
}
That's going to create ticker instances as fast as possible, and because of the nature of ticker objects they won't be able to clean up ( they're referenced by the implementation of ticket which, due to its async nature, happens in a different goroutine). Go can do this very quickly, resulting in OOM ( out of memory) error very rapidly.
But this pattern doesn't make any sense. There's no good reason to create new tickers like this in a for
loop. You can create multiple tickers, even very many of them, but you can't create infinite tickers, nor does it make much sense to do so.
Further, notice you're not actually using your tickers anywhere. Consider the example here: https://gobyexample.com/tickers . You'll see how they interact with the ticker to make code run with each tick. Note the ticker there is created once, not in a loop.