title: Read line in golang
body: <p>There are so many option to do this in Go. For example:</p>
  
  <pre><code>scanner := bufio.NewScanner(os.Stdin)
  for scanner.Scan() {
      fmt.Println(scanner.Text())
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>reader := bufio.NewReader(os.Stdin)
  text, _ := reader.ReadString('\n')
  </code></pre>
  
  <p>Neither is working in my case. I am unable to find the reason why new line scan is not working.</p>
  
  <p>Here's the question I'm working on: <a href="https://www.hackerrank.com/challenges/30-dictionaries-and-maps" rel="nofollow">https://www.hackerrank.com/challenges/30-dictionaries-and-maps</a></p>
  
  <p>And here's my code:</p>
  
  <pre><code>package main
  import (
      "fmt"
      "bufio"
      "os"
      "strings"
  )
  
  func main() {
      var count int
      fmt.Scan(&amp;count)
  
      m := make(map[string]string)
      for i := 0; i&lt;count; i++{
          reader := bufio.NewReader(os.Stdin)
          text,err := reader.ReadString('\n')
          if err != nil {
             fmt.Println(err)
          }
          value := strings.Fields(text)
          m[value[0]] = value[1]
      }
      var names []string
      for i := 0; i&lt;count; i++{
          var name string
          fmt.Scan(&amp;name)
          names = append(names,name)
      }
  
      for j:= 0; j&lt;len(names);j++{
          if m[names[j]] != ""{
              fmt.Println(names[j] +" = "+ m[names[j]])
          }else{
              fmt.Println("Not found")
          }
  
      }
  
  }
  </code></pre>
  
  <p>It is working in my editor, but when I use the question's input, it doesn't work.</p>