27 lines
404 B
Go
27 lines
404 B
Go
|
//
|
||
|
// file_read.go
|
||
|
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
||
|
//
|
||
|
// 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
|
||
|
}
|