From 0692da7b4fa7568c62b505a313ee44a5256ee7f4 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Sat, 15 Aug 2015 14:36:24 -0400 Subject: Fix up minor things found by goreportcard.com --- ipnet.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ipnet.go') diff --git a/ipnet.go b/ipnet.go index 23b7fd3..149b764 100644 --- a/ipnet.go +++ b/ipnet.go @@ -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) } -- cgit v1.2.3