title: Break out of input.Scan()
body: <p>I have this simple code to read all input from the console:</p>
  
  <pre><code>input := bufio.NewScanner(os.Stdin) //Creating a Scanner that will read the input from the console
  
  for input.Scan() {
      if input.Text() == "end" { break } //Break out of input loop when the user types the word "end"
      fmt.Println(input.Text())
  }
  </code></pre>
  
  <p>The code as it is works. What I want to do is get rid of the if-clause. In my understanding of the documentation if a line is empty <code>input.Scan()</code> should return false and therefore break out of the loop.</p>
  
  <blockquote>
    <p>Scan advances the Scanner to the next token, which will then be available through the Bytes or Text method. It returns false when the scan stops, either by reaching the end of the input or an error. After Scan returns false, the Err method will return any error that occurred during scanning, except that if it was <code>io.EOF</code>, Err will return nil. Scan panics if the split function returns 100 empty tokens without advancing the input. This is a common error mode for scanners.</p>
  </blockquote>
  
  <p>Am I misinterpreting the documentation and it is actually necessary to have such a if-clause to break out? (I'm using Go 1.5.2 running the program using "go run".)</p>