You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
418 B

package main
import (
"context"
"os/signal"
"strings"
"syscall"
"time"
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGKILL, syscall.SIGINT)
defer cancel()
init := "Hello, World!"
ticker := time.NewTicker(time.Second)
mainloop:
for {
select {
case <-ctx.Done():
break mainloop
case <-ticker.C:
init = strings.Repeat(init, 10)
}
}
}