aboutsummaryrefslogtreecommitdiff
path: root/ip.go
diff options
context:
space:
mode:
Diffstat (limited to 'ip.go')
-rw-r--r--ip.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/ip.go b/ip.go
index 746eefd..baa442b 100644
--- a/ip.go
+++ b/ip.go
@@ -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)
}