Skip to content

Instantly share code, notes, and snippets.

@kevsersrca
Last active March 22, 2018 08:26
Show Gist options
  • Save kevsersrca/2c29f53f2eeaf41fb43cbe624f5c95b3 to your computer and use it in GitHub Desktop.
Save kevsersrca/2c29f53f2eeaf41fb43cbe624f5c95b3 to your computer and use it in GitHub Desktop.
golang file read
file, _ := os.Open(path)
defer inFile.Close()
scanner := bufio.NewScanner(file) {
    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