Golang flag.FlagSet.SetOutput() function example

package flag

SetOutput sets the destination for usage and error messages. If output is nil, os.Stderr is used.

Golang flag.FlagSet.SetOutput() function usage example

 f := flag.NewFlagSet("", flag.ContinueOnError)
 f.SetOutput(ioutil.Discard) // send all usage and error messages to blackhole

Reference :

http://golang.org/pkg/flag/#FlagSet.SetOutput

Advertisement