From: Ian Lance Taylor Date: Mon, 15 Aug 2016 03:39:30 +0000 (-0700) Subject: flag: document that Value.String must work on the zero value X-Git-Tag: go1.8beta1~1683 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5e66ac9ac61efb045f8ae28ff0fc019a4a98b473;p=gostls13.git flag: document that Value.String must work on the zero value Otherwise flag.PrintDefaults will fail when it tries to determine whether the default is the zero value. Fixes #16694. Change-Id: I253fbf11ffc0a9069fd48c2c3cf3074df53e3a03 Reviewed-on: https://go-review.googlesource.com/27003 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/flag/flag.go b/src/flag/flag.go index fa0f05e968..6c9b292b26 100644 --- a/src/flag/flag.go +++ b/src/flag/flag.go @@ -238,6 +238,7 @@ func (d *durationValue) String() string { return (*time.Duration)(d).String() } // rather than using the next command-line argument. // // Set is called once, in command line order, for each flag present. +// String must work on the zero value of the dynamic type. type Value interface { String() string Set(string) error