1
0
mirror of https://github.com/golang/go synced 2024-09-30 08:28:34 -06:00

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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-08-14 20:39:30 -07:00
parent eb29ac7a7c
commit 5e66ac9ac6

View File

@ -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