Skip to content

Commit e9f8d67

Browse files
committed
flag: clarify that a flag cannot be re-defined
Fixes #31694 Change-Id: Ifb2ad2dc41c449668c0f6a4d4cfb9b583e5591f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/206126 Reviewed-by: Rob Pike <[email protected]>
1 parent 0e312f2 commit e9f8d67

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/flag/flag.go

+3
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ const (
314314

315315
// A FlagSet represents a set of defined flags. The zero value of a FlagSet
316316
// has no name and has ContinueOnError error handling.
317+
//
318+
// Flag names must be unique within a FlagSet. An attempt to define a flag whose
319+
// name is already in use will cause a panic.
317320
type FlagSet struct {
318321
// Usage is the function called when an error occurs while parsing flags.
319322
// The field is a function (not a method) that may be changed to point to

0 commit comments

Comments
 (0)