diff options
| author | Eric Paris <[email protected]> | 2015-08-05 16:23:55 -0400 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-08-05 19:30:09 -0400 |
| commit | 30bf08c0d6db97cd5c95c4a9c5f826cfcec977f7 (patch) | |
| tree | e4d9ed8f116f10a1c88364bcd941639519816195 /ip.go | |
| parent | c2a4060756151d538849fcfb494209d5315ec460 (diff) | |
Add _test for the net.IP flag type
Diffstat (limited to 'ip.go')
| -rw-r--r-- | ip.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -3,8 +3,11 @@ package pflag import ( "fmt" "net" + "strings" ) +var _ = strings.TrimSpace + // -- net.IP value type ipValue net.IP @@ -15,7 +18,7 @@ func newIPValue(val net.IP, p *net.IP) *ipValue { func (i *ipValue) String() string { return net.IP(*i).String() } func (i *ipValue) Set(s string) error { - ip := net.ParseIP(s) + ip := net.ParseIP(strings.TrimSpace(s)) if ip == nil { return fmt.Errorf("failed to parse IP: %q", s) } |
