Pemindai Golang Bufio

fmt.Println()
file, err := os.Open("/path/to/file.txt") // opens file object
if err != nil {
	log.Fatal(err)
}
defer file.Close()

scanner := bufio.NewScanner(file) // scanner (could be 'lines') that scans line-by-line
// optionally, resize scanner's capacity for lines over 64K, see next example
for scanner.Scan() {
	fmt.Println(scanner.Text())
}

if err := scanner.Err(); err != nil { // very important it yields an error in case e.g. there was buffer full and
	log.Fatal(err) // all lines were not scanned through
}
smjure