title: How to improve this file reading code
body: <p>I currently have this piece of code that will read a file line by line (delimited by a \n) </p>
  
  <pre><code>file, _ := os.Open(filename) //deal with the error later
  defer file.Close()
  
  buf := bufio.NewReader(file)
  for line, err := buf.ReadString('\n'); err != io.EOF; line, err = buf.ReadString('\n')
  {
      fmt.Println(strings.TrimRight(line, "\n"))
  }
  </code></pre>
  
  <p>However I don't feel comfortable with writing <code>buf.ReadString("\n")</code> twice in the for loop, does anyone have any suggestions for improvement?</p>