Skip to content

Commit 8050782

Browse files
flag: improve comment for calling String with zero value
Update #16694. Change-Id: Id6be1535d8a146b3dac3bee429ce407a51272032 Reviewed-on: https://go-review.googlesource.com/27634 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent 78fac02 commit 8050782

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/flag/flag.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ 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.
241+
// The flag package may call the String method with a zero-valued receiver,
242+
// such as a nil pointer.
242243
type Value interface {
243244
String() string
244245
Set(string) error

0 commit comments

Comments
 (0)