title: Why does "fmt.Sprintf("%v,", lines[i])" put the comma on new line?
body: <p>This is the full code:</p>
  
  <pre><code>files, _ := ioutil.ReadDir("files")
  for _, f := range files {
      input, err := ioutil.ReadFile("files/" + f.Name())
      lines := strings.Split(string(input), "\n")
  
      for i, _ := range lines {
          lines[i] = fmt.Sprintf("%v,", lines[i])
      }
  
      output := strings.Join(lines, "\n")
      err = ioutil.WriteFile("files/"+f.Name()+"fix", []byte(output), 0644)
      if err != nil {
          log.Fatalln(err)
      }
  }
  </code></pre>
  
  <p>I assume it is because lines[i] must contain a newline byte at the end of the string.. I have tried to remove it but failed..</p>
  
  <p>The files I load are just json files e.g.</p>
  
  <p>line 1: <code>{ "foo":"bar","baz":null }</code></p>
  
  <p>line 2: <code>{ "foo":"bar","baz":"quz" }</code></p>
  
  <p>Where I am trying to add a comma to the end of all lines.. any help would be much appreciated</p>
  
  <p>Just to make myself a little more clear, what I get now is:</p>
  
  <pre><code>{ "foo":"bar","baz":null }
  ,
  { "foo":"bar","baz":"quz" }
  ,
  </code></pre>
  
  <p>whereas what I want to get is:</p>
  
  <pre><code>{ "foo":"bar","baz":null },
  { "foo":"bar","baz":"quz" },
  </code></pre>