サンプルコード
約1秒毎に数字を出すだけのサンプル。
package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i < 10; i++ {
time.Sleep(time.Second * 1)
fmt.Print(i + 1, "\n")
}
}
おまけ
1分スリープさせるなら
time.Sleep(time.Minute * 1)
const (
Nanosecond Duration = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
)