Skip to content

Instantly share code, notes, and snippets.

@philippbayer
Created February 10, 2013 06:54
Show Gist options
  • Save philippbayer/4748677 to your computer and use it in GitHub Desktop.
Save philippbayer/4748677 to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
f, err := os.Open("./example")
if err != nil {
panic(err)
}
defer f.Close()
r := bufio.NewReader(f)
if err != nil {
fmt.Println(err)
return
}
line, isPrefix, err := r.ReadLine()
for err == nil && !isPrefix {
s := string(line)
fmt.Println(s)
line, isPrefix, err = r.ReadLine()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment