Skip to content

Instantly share code, notes, and snippets.

@bodepd
Last active December 23, 2015 05:08
Show Gist options
  • Select an option

  • Save bodepd/6584526 to your computer and use it in GitHub Desktop.

Select an option

Save bodepd/6584526 to your computer and use it in GitHub Desktop.
...
file, err := os.Open(filename)
if err != nil {
panic(err)
}
defer file.Close()
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment