Skip to content

Instantly share code, notes, and snippets.

@kendellfab
Created November 11, 2013 17:41
  • Star 45 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kendellfab/7417164 to your computer and use it in GitHub Desktop.
Golang --> Read file line by line.
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