From e308807f658c11af52804d55c1b8c4b2cf80d3f3 Mon Sep 17 00:00:00 2001 From: Aaron Cannon Date: Sat, 27 Oct 2018 11:21:00 -0500 Subject: [PATCH] flag: improve docs for PrintDefaults; clarify how to change output destination The existing docs only mention that it is possible to change the output destination of PrintDefaults from the default of standard error, but fail to mention how to actually do so. This change fixes this lack by directing users to CommandLine.SetOutput. Fixes #15024 Change-Id: Ieaa7edbebd23d4ea6fa7e53d97a87143d590bdb3 Reviewed-on: https://go-review.googlesource.com/c/145203 Reviewed-by: Rob Pike --- src/flag/flag.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/flag/flag.go b/src/flag/flag.go index 2eef9d6ab9..c312c62a58 100644 --- a/src/flag/flag.go +++ b/src/flag/flag.go @@ -548,6 +548,8 @@ func (f *FlagSet) PrintDefaults() { // the output will be // -I directory // search directory for include files. +// +// To change the destination for flag messages, call CommandLine.SetOutput. func PrintDefaults() { CommandLine.PrintDefaults() } -- 2.48.1