title: Go : concatenate file contents
body: <p>I'm currently learning how to develop with Go (or golang) and I have a strange issue:</p>
  
  <p>I try to create a script looking inside an HTML file in order to get all the sources of each <strong></strong> tags.
  The goal of the script is to merge all the retrieved files.</p>
  
  <p>So, that's for the story: for now, I'm able to get the content of each JavaScript files but... I can't concatenate them...</p>
  
  <p>You can see below my script:</p>
  
  <pre><code>//Open main file
  mainFilePath := "/path/to/my/file.html"
  mainFileDir := path.Dir(mainFilePath)+"/"
  
  mainFileContent, err := ioutil.ReadFile(mainFilePath)
  
  if err == nil {
      mainFileContent := string(mainFileContent)
      var finalFileContent bytes.Buffer
  
      //Start RegExp searching for JavaScript src
      scriptReg, _ := regexp.Compile("&lt;script src=\"(.*)\"&gt;")
      scripts := scriptReg.FindAllStringSubmatch(mainFileContent,-1)
  
      //For each SRC found...
      for _, path := range scripts {
          //We open the corresponding file
          subFileContent, err := ioutil.ReadFile(mainFileDir+path[1])
  
          if err == nil {
              //And we add its content to the "final" variable
              fmt.Println(finalFileContent.Write(subFileContent))
          } else {
              fmt.Println(err)
          }
      }
  
      //Try to display the final result
      // fmt.Println(finalFileContent.String())
      fmt.Printf("&gt;&gt;&gt; %#v", finalFileContent)
      fmt.Println("Y U NO WORKS? :'(")
  
  } else {
      fmt.Println(err)
  }
  </code></pre>
  
  <p>So, each <code>fmt.Println(finalFileContent.Write(subFileContent))</code> display something like <strong>6161 </strong>, so I assume the <em>Write()</em> method is correctly executed.</p>
  
  <p>But <code>fmt.Printf("&gt;&gt;&gt; %#v", finalFileContent)</code> displays nothing. Absolutely nothing (even the ">>>" are not displayed!) And it's the same for the commented line just above.</p>
  
  <p>The funny part is that the string <em>"Y U NO WORK ? :'("</em> is correctly displayed...</p>
  
  <p>Do you know why?
  And do you know how to solve this issue?</p>
  
  <p>Thanks in advance!</p>