diff options
| author | Eric Paris <[email protected]> | 2015-08-15 14:36:24 -0400 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-08-15 15:10:25 -0400 |
| commit | 0692da7b4fa7568c62b505a313ee44a5256ee7f4 (patch) | |
| tree | 073d50d4008eb882cdbe0e9f6a6eff943f5db256 /ipnet.go | |
| parent | 1ad164813157ed6d752ca39b5ac46eb3ae99093b (diff) | |
Fix up minor things found by goreportcard.com
Diffstat (limited to 'ipnet.go')
| -rw-r--r-- | ipnet.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -7,31 +7,31 @@ import ( ) // IPNet adapts net.IPNet for use as a flag. -type IPNetValue net.IPNet +type ipNetValue net.IPNet -func (ipnet IPNetValue) String() string { +func (ipnet ipNetValue) String() string { n := net.IPNet(ipnet) return n.String() } -func (ipnet *IPNetValue) Set(value string) error { +func (ipnet *ipNetValue) Set(value string) error { _, n, err := net.ParseCIDR(strings.TrimSpace(value)) if err != nil { return err } - *ipnet = IPNetValue(*n) + *ipnet = ipNetValue(*n) return nil } -func (*IPNetValue) Type() string { +func (*ipNetValue) Type() string { return "ipNet" } var _ = strings.TrimSpace -func newIPNetValue(val net.IPNet, p *net.IPNet) *IPNetValue { +func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue { *p = val - return (*IPNetValue)(p) + return (*ipNetValue)(p) } func ipNetConv(sval string) (interface{}, error) { @@ -57,7 +57,7 @@ func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage str f.VarP(newIPNetValue(value, p), name, "", usage) } -// Like IPNetVar, but accepts a shorthand letter that can be used after a single dash. +// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { f.VarP(newIPNetValue(value, p), name, shorthand, usage) } @@ -68,7 +68,7 @@ func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { CommandLine.VarP(newIPNetValue(value, p), name, "", usage) } -// Like IPNetVar, but accepts a shorthand letter that can be used after a single dash. +// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage) } @@ -81,7 +81,7 @@ func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet { return p } -// Like IPNet, but accepts a shorthand letter that can be used after a single dash. +// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { p := new(net.IPNet) f.IPNetVarP(p, name, shorthand, value, usage) @@ -94,7 +94,7 @@ func IPNet(name string, value net.IPNet, usage string) *net.IPNet { return CommandLine.IPNetP(name, "", value, usage) } -// Like IPNet, but accepts a shorthand letter that can be used after a single dash. +// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { return CommandLine.IPNetP(name, shorthand, value, usage) } |
