Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Created November 26, 2018 12:22
Show Gist options
  • Save jreisinger/2c178ce37e9ac9012d75cdbb3d1581ff to your computer and use it in GitHub Desktop.
Save jreisinger/2c178ce37e9ac9012d75cdbb3d1581ff to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io"
"os"
)
var output = make(map[io.Writer]bool)
func main() {
output[os.Stdout] = true
output[os.Stderr] = false
for w, enabled := range output {
if enabled {
fmt.Fprintf(w, "Some output\n")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment