Standard library / flag

flag.FlagSet.Output()

Returns the writer used for help and diagnostics; nil output defaults to stderr. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (f *FlagSet) Output() io.Writer

Return Value

io.Writer

Returns the writer used for help and diagnostics; nil output defaults to stderr.

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt"  "os")
func main() { f := flag.NewFlagSet("demo", flag.ContinueOnError); fmt.Println(f.Output() == os.Stderr) }
Go Reference