文件工具 我根据网络上各种公共资源中提供的示例编写的 Golang 文本文件读取和写入实用程序。 /* * Reads a file line by line into a channel * * c := fileutil.ReadLinesChannel(fileName) * for line := range c { * fmt.Printf(" Line: %s\n", line) * } */ func ReadLinesChannel(fileName string) <-chan string /* * Reads a file line by line into an array * * lines, err := fileutil.ReadLinesArray(fileName) * if err != nil { *