02 2022 档案

摘要:package main import ( "fmt" "math/rand" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } func main() { ch1 := make(chan bool) timeout := make 阅读全文
posted @ 2022-02-11 10:59 wangsk 阅读(242) 评论(0) 推荐(0) 编辑
摘要:package main import ( "bufio" "fmt" "io/fs" "os" "path/filepath" "strings" "sync" ) func FileLine(path string) int { file, err := os.Open(path) //定义行数 阅读全文
posted @ 2022-02-10 15:50 wangsk 阅读(249) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "io/ioutil" ) func FormatSize(size int64) string { units := [6]string{"B", "KB", "MB", "GB", "TB", "PB"} fsize := float64( 阅读全文
posted @ 2022-02-03 16:44 wangsk 阅读(72) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "io" "os" ) /* 拷贝文件 读 写入新文件 */ func CopyFile(src, dest string) error { srcFile, err := os.Open(src) if err != nil { return 阅读全文
posted @ 2022-02-03 15:34 wangsk 阅读(296) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "io" "os" "strings" ) type fileFilter func(fpath string) bool type callBack func(path string) func ReadFile(path string) { 阅读全文
posted @ 2022-02-03 11:17 wangsk 阅读(111) 评论(0) 推荐(0) 编辑
摘要:package main import ( "log" "os" ) func main() { file, err := os.OpenFile("logfile.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModePerm) if err != nil 阅读全文
posted @ 2022-02-03 10:12 wangsk 阅读(415) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示