aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorAlbert Nigmatzianov <[email protected]>2017-04-18 09:13:28 +0200
committerAlbert Nigmatzianov <[email protected]>2017-04-26 21:20:41 +0200
commit686edd74ba72b749a641eb7e5ac5a8181b829c6e (patch)
treeeb0dff3ff419026f2d7b375de2baa51a3a40466a /flag.go
parentaf10531e7528b9f461bb5a14e70b1ca615882945 (diff)
Fix alreadythere variable name
In some cases "exists" is better to understand
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/flag.go b/flag.go
index 0730bd6..e14d839 100644
--- a/flag.go
+++ b/flag.go
@@ -759,8 +759,8 @@ func (f *FlagSet) AddFlag(flag *Flag) {
// Call normalizeFlagName function only once
normalizedFlagName := f.normalizeFlagName(flag.Name)
- _, alreadythere := f.formal[normalizedFlagName]
- if alreadythere {
+ _, alreadyThere := f.formal[normalizedFlagName]
+ if alreadyThere {
msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
fmt.Fprintln(f.out(), msg)
panic(msg) // Happens only if flags are declared with identical names
@@ -784,8 +784,8 @@ func (f *FlagSet) AddFlag(flag *Flag) {
f.shorthands = make(map[byte]*Flag)
}
c := flag.Shorthand[0]
- old, alreadythere := f.shorthands[c]
- if alreadythere {
+ old, alreadyThere := f.shorthands[c]
+ if alreadyThere {
fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name)
panic("shorthand redefinition")
}
@@ -879,8 +879,8 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
}
split := strings.SplitN(name, "=", 2)
name = split[0]
- flag, alreadythere := f.formal[f.normalizeFlagName(name)]
- if !alreadythere {
+ flag, exists := f.formal[f.normalizeFlagName(name)]
+ if !exists {
if name == "help" { // special case for nice help message.
f.usage()
return a, ErrHelp
@@ -916,8 +916,8 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
outShorts = shorthands[1:]
c := shorthands[0]
- flag, alreadythere := f.shorthands[c]
- if !alreadythere {
+ flag, exists := f.shorthands[c]
+ if !exists {
if c == 'h' { // special case for nice help message.
f.usage()
err = ErrHelp