Skip to content

Instantly share code, notes, and snippets.

@yujinqiu
Forked from kendellfab/read_line.go
Created December 12, 2014 09:47
Show Gist options
  • Save yujinqiu/bc1da2c198b966c0ee17 to your computer and use it in GitHub Desktop.
Save yujinqiu/bc1da2c198b966c0ee17 to your computer and use it in GitHub Desktop.
func readLine(path string) {
inFile, _ := os.Open(path)
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment