Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Last active June 5, 2022 10:25
Show Gist options
  • Save narenaryan/70cee857f48dd6bbd5a5c80be9143e5e to your computer and use it in GitHub Desktop.
Save narenaryan/70cee857f48dd6bbd5a5c80be9143e5e to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"fmt"
)
func main() {
// Empty buffer (implements io.Writer)
var b bytes.Buffer
fmt.Fprintln(&b, "Hello Medium") // Don't forget &
// Optional: Check the contents stored
fmt.Println(b.String()) // Prints `Hello Medium`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment