Go 무한반복 스크립트

1 개요[ | ]

package main

import (
    "fmt"
    "time"
)

func main() {
    for {
        fmt.Println("hello", time.Now())
        time.Sleep(time.Second)
    }
}
root@localhost:~# go run a.go
hello 2020-07-17 08:36:43.679258186 +0000 UTC m=+0.000061324
hello 2020-07-17 08:36:44.679424323 +0000 UTC m=+1.000227493
hello 2020-07-17 08:36:45.679543983 +0000 UTC m=+2.000347152
hello 2020-07-17 08:36:46.679619966 +0000 UTC m=+3.000423111
hello 2020-07-17 08:36:47.679749468 +0000 UTC m=+4.000552611
hello 2020-07-17 08:36:48.679848239 +0000 UTC m=+5.000651419
^Csignal: interrupt

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}