Last active
January 10, 2017 07:49
-
-
Save juwencheng/3d1b6e0d0618ba0bf467a6332d13f757 to your computer and use it in GitHub Desktop.
将内容以覆盖的形式写入文件中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io/ioutil" | |
"time" | |
) | |
func main() { | |
counter := 0 | |
go func() { | |
for { | |
ioutil.WriteFile("./truncate.txt", []byte(fmt.Sprintf("%d", counter)), 0755) | |
counter++ | |
time.Sleep(3 * time.Second) | |
} | |
}() | |
time.Sleep(500 * time.Second) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment