Skip to content

Commit 0692da7

Browse files
committed
Fix up minor things found by goreportcard.com
1 parent 1ad1648 commit 0692da7

23 files changed

+230
-196
lines changed

bool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {
5353
f.BoolVarP(p, name, "", value, usage)
5454
}
5555

56-
// Like BoolVar, but accepts a shorthand letter that can be used after a single dash.
56+
// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
5757
func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
5858
flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage)
5959
flag.NoOptDefVal = "true"
@@ -65,7 +65,7 @@ func BoolVar(p *bool, name string, value bool, usage string) {
6565
BoolVarP(p, name, "", value, usage)
6666
}
6767

68-
// Like BoolVar, but accepts a shorthand letter that can be used after a single dash.
68+
// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
6969
func BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
7070
flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage)
7171
flag.NoOptDefVal = "true"
@@ -77,7 +77,7 @@ func (f *FlagSet) Bool(name string, value bool, usage string) *bool {
7777
return f.BoolP(name, "", value, usage)
7878
}
7979

80-
// Like Bool, but accepts a shorthand letter that can be used after a single dash.
80+
// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
8181
func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool {
8282
p := new(bool)
8383
f.BoolVarP(p, name, shorthand, value, usage)
@@ -90,7 +90,7 @@ func Bool(name string, value bool, usage string) *bool {
9090
return BoolP(name, "", value, usage)
9191
}
9292

93-
// Like Bool, but accepts a shorthand letter that can be used after a single dash.
93+
// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
9494
func BoolP(name, shorthand string, value bool, usage string) *bool {
9595
b := CommandLine.BoolP(name, shorthand, value, usage)
9696
return b

count.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func countConv(sval string) (interface{}, error) {
3838
return i, nil
3939
}
4040

41+
// GetCount return the int value of a flag with the given name
4142
func (f *FlagSet) GetCount(name string) (int, error) {
4243
val, err := f.getFlagType(name, "count", countConv)
4344
if err != nil {
@@ -46,39 +47,51 @@ func (f *FlagSet) GetCount(name string) (int, error) {
4647
return val.(int), nil
4748
}
4849

50+
// CountVar defines a count flag with specified name, default value, and usage string.
51+
// The argument p points to an int variable in which to store the value of the flag.
52+
// A count flag will add 1 to its value evey time it is found on the command line
4953
func (f *FlagSet) CountVar(p *int, name string, usage string) {
5054
f.CountVarP(p, name, "", usage)
5155
}
5256

57+
// CountVarP is like CountVar only take a shorthand for the flag name.
5358
func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) {
5459
flag := f.VarPF(newCountValue(0, p), name, shorthand, usage)
5560
flag.NoOptDefVal = "-1"
5661
}
5762

63+
// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set
5864
func CountVar(p *int, name string, usage string) {
5965
CommandLine.CountVar(p, name, usage)
6066
}
6167

68+
// CountVarP is like CountVar only take a shorthand for the flag name.
6269
func CountVarP(p *int, name, shorthand string, usage string) {
6370
CommandLine.CountVarP(p, name, shorthand, usage)
6471
}
6572

73+
// Count defines a count flag with specified name, default value, and usage string.
74+
// The return value is the address of an int variable that stores the value of the flag.
75+
// A count flag will add 1 to its value evey time it is found on the command line
6676
func (f *FlagSet) Count(name string, usage string) *int {
6777
p := new(int)
6878
f.CountVarP(p, name, "", usage)
6979
return p
7080
}
7181

82+
// CountP is like Count only takes a shorthand for the flag name.
7283
func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
7384
p := new(int)
7485
f.CountVarP(p, name, shorthand, usage)
7586
return p
7687
}
7788

89+
// Count like Count only the flag is placed on the CommandLine isntead of a given flag set
7890
func Count(name string, usage string) *int {
7991
return CommandLine.CountP(name, "", usage)
8092
}
8193

94+
// CountP is like Count only takes a shorthand for the flag name.
8295
func CountP(name, shorthand string, usage string) *int {
8396
return CommandLine.CountP(name, shorthand, usage)
8497
}

duration.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration
4343
f.VarP(newDurationValue(value, p), name, "", usage)
4444
}
4545

46-
// Like DurationVar, but accepts a shorthand letter that can be used after a single dash.
46+
// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
4747
func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
4848
f.VarP(newDurationValue(value, p), name, shorthand, usage)
4949
}
@@ -54,7 +54,7 @@ func DurationVar(p *time.Duration, name string, value time.Duration, usage strin
5454
CommandLine.VarP(newDurationValue(value, p), name, "", usage)
5555
}
5656

57-
// Like DurationVar, but accepts a shorthand letter that can be used after a single dash.
57+
// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
5858
func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
5959
CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage)
6060
}
@@ -67,7 +67,7 @@ func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time
6767
return p
6868
}
6969

70-
// Like Duration, but accepts a shorthand letter that can be used after a single dash.
70+
// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
7171
func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
7272
p := new(time.Duration)
7373
f.DurationVarP(p, name, shorthand, value, usage)
@@ -80,7 +80,7 @@ func Duration(name string, value time.Duration, usage string) *time.Duration {
8080
return CommandLine.DurationP(name, "", value, usage)
8181
}
8282

83-
// Like Duration, but accepts a shorthand letter that can be used after a single dash.
83+
// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
8484
func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
8585
return CommandLine.DurationP(name, shorthand, value, usage)
8686
}

0 commit comments

Comments
 (0)