title: Golang: Issues replacing newlines in a string from a text file
body: <p>I've been trying to have a File be read, which will then put the read material into a string. Then the string will get split by line into multiple strings:</p>
  <pre><code>absPath, _ := filepath.Abs(&quot;../Go/input.txt&quot;)
  data, err := ioutil.ReadFile(absPath)
  if err != nil {
      panic(err)
  }
  input := string(data)
  </code></pre>
  <p>The input.txt is read as:</p>
  <blockquote>
  <p>a</p>
  <p>strong little bird</p>
  <p>with a very</p>
  <p>big heart</p>
  <p>went</p>
  <p>to school one day and</p>
  <p>forgot his food at</p>
  <p>home</p>
  </blockquote>
  <p>However,</p>
  <pre><code>re = regexp.MustCompile(&quot;\\n&quot;)
  input = re.ReplaceAllString(input, &quot; &quot;)
  </code></pre>
  <p>turns the text into a mangled mess of:</p>
  <blockquote>
  <p>homeot his food atand</p>
  </blockquote>
  <p>I'm not sure how replacing newlines can mess up so badly to the point where the text inverts itself</p>