02 2022 档案
摘要:package main import ( "fmt" "math/rand" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } func main() { ch1 := make(chan bool) timeout := make
阅读全文
摘要:package main import ( "bufio" "fmt" "io/fs" "os" "path/filepath" "strings" "sync" ) func FileLine(path string) int { file, err := os.Open(path) //定义行数
阅读全文
摘要:package main import ( "fmt" "io/ioutil" ) func FormatSize(size int64) string { units := [6]string{"B", "KB", "MB", "GB", "TB", "PB"} fsize := float64(
阅读全文
摘要:package main import ( "fmt" "io" "os" ) /* 拷贝文件 读 写入新文件 */ func CopyFile(src, dest string) error { srcFile, err := os.Open(src) if err != nil { return
阅读全文
摘要:package main import ( "fmt" "io" "os" "strings" ) type fileFilter func(fpath string) bool type callBack func(path string) func ReadFile(path string) {
阅读全文
摘要: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
阅读全文