]> Cypherpunks repositories - gostls13.git/commitdiff
flag: document that Value.String must work on the zero value
authorIan Lance Taylor <iant@golang.org>
Mon, 15 Aug 2016 03:39:30 +0000 (20:39 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 23 Aug 2016 16:26:43 +0000 (16:26 +0000)
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>
src/flag/flag.go

index fa0f05e96830128cdb2e8aac2a991c730f358ba2..6c9b292b26d7621b831a1bd321011a33a27a9235 100644 (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