title: Can I make a prefilled string in golang with make or new?
body: <p>I am trying to optimize my stringpad library in Go. So far the only way I have found to fill a string (actually bytes.Buffer) with a known character value (ex. 0 or " ") is with a for loop.</p>
  
  <p>the snippet of code is:</p>
  
  <pre><code>// PadLeft pads string on left side with p, c times
  func PadLeft(s string, p string, c int) string {
      var t bytes.Buffer
      if c &lt;= 0 {
          return s
      }
      if len(p) &lt; 1 {
          return s
      }
      for i := 0; i &lt; c; i++ {
          t.WriteString(p)
      }
      t.WriteString(s)
      return t.String()
  }
  </code></pre>
  
  <p>The larger the string pad I believe there is more memory copies of the t buffer. Is there a more elegant way to make a known size buffer with a known value on initialization?</p>