title: In Go, how do I capture stdout of a function into a string?
body: <p>In Python, for example, I can do the following:</p>
  
  <pre><code>realout = sys.stdout
  sys.stdout = StringIO.StringIO()
  some_function() # prints to stdout get captured in the StringIO object
  result = sys.stdout.getvalue()
  sys.stdout = realout
  </code></pre>
  
  <p>Can you do this in Go?</p>