aboutsummaryrefslogtreecommitdiff
path: root/src/flag
diff options
context:
space:
mode:
authorAgniva De Sarker <agnivade@yahoo.co.in>2019-11-11 12:02:56 +0530
committerAgniva De Sarker <agniva.quicksilver@gmail.com>2019-11-11 20:07:54 +0000
commite9f8d676ae40b0ce35efb5838eec560f7b6cf1fc (patch)
tree0cfa95a83a3a73e8eddbb6d3868a6a8ebe1005a1 /src/flag
parent0e312f212c11b9f35fdd85bcbb6ec082bc341c17 (diff)
downloadgo-e9f8d676ae40b0ce35efb5838eec560f7b6cf1fc.tar.gz
go-e9f8d676ae40b0ce35efb5838eec560f7b6cf1fc.zip
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 <r@golang.org>
Diffstat (limited to 'src/flag')
-rw-r--r--src/flag/flag.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/flag/flag.go b/src/flag/flag.go
index 9fed4d82b3..6a51617524 100644
--- a/src/flag/flag.go
+++ b/src/flag/flag.go
@@ -314,6 +314,9 @@ const (
// A FlagSet represents a set of defined flags. The zero value of a FlagSet
// has no name and has ContinueOnError error handling.
+//
+// Flag names must be unique within a FlagSet. An attempt to define a flag whose
+// name is already in use will cause a panic.
type FlagSet struct {
// Usage is the function called when an error occurs while parsing flags.
// The field is a function (not a method) that may be changed to point to