Преглед изворни кода

Fix panic when using default-initialized FlagSet

Closes #13294

Signed-off-by: Sebastien Rannou <mxs@sbrk.org>
s. rannou пре 10 година
родитељ
комит
e94bab8278
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      pkg/mflag/flag.go

+ 1 - 1
pkg/mflag/flag.go

@@ -560,7 +560,7 @@ func defaultUsage(f *FlagSet) {
 // Usage prints to standard error a usage message documenting all defined command-line flags.
 // Usage prints to standard error a usage message documenting all defined command-line flags.
 // The function is a variable that may be changed to point to a custom function.
 // The function is a variable that may be changed to point to a custom function.
 var Usage = func() {
 var Usage = func() {
-	fmt.Fprintf(CommandLine.output, "Usage of %s:\n", os.Args[0])
+	fmt.Fprintf(CommandLine.Out(), "Usage of %s:\n", os.Args[0])
 	PrintDefaults()
 	PrintDefaults()
 }
 }