Skip to content

Commit 5e66ac9

Browse files
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent eb29ac7 commit 5e66ac9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/flag/flag.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ func (d *durationValue) String() string { return (*time.Duration)(d).String() }
238238
// rather than using the next command-line argument.
239239
//
240240
// Set is called once, in command line order, for each flag present.
241+
// String must work on the zero value of the dynamic type.
241242
type Value interface {
242243
String() string
243244
Set(string) error

0 commit comments

Comments
 (0)