// // file_read.go // Copyright (C) 2023 tiglog // // Distributed under terms of the MIT license. // package gfile import ( "bufio" "os" ) // fd, _ := os.Open(filePath) // defer fd.Close() // fs := gfile.ReadFile(fd) // // for fs.Scan() { // fmt.Println(fs.Text()) // } func ReadFile(fd *os.File) *bufio.Scanner { fs := bufio.NewScanner(fd) fs.Split(bufio.ScanLines) return fs }