Skip to content

Instantly share code, notes, and snippets.

@grantseltzer
Last active April 4, 2019 20:08
Show Gist options
  • Save grantseltzer/6180cb497c183db219303223252aadff to your computer and use it in GitHub Desktop.
Save grantseltzer/6180cb497c183db219303223252aadff to your computer and use it in GitHub Desktop.
// This defeats the purpose of io.Writer
func WriteAsciiArtToFile(path string) error {
f, err := os.Open(path)
if err != nil {
return err
}
artBytes := makeSomeArt()
_, err = f.Write(artBytes)
return err
}
// Not an anti-pattern, idgaf what you do with my ascii art
func WriteAsciiArt(w io.Writer) (n int, error) {
artBytes := makeSomeArt()
return w.Write(artBytes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment