mirror of https://github.com/docker/cli.git
opts.IPVal returns an error on incorrect input
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
parent
a6487884e5
commit
1edb726c0b
|
@ -1,6 +1,7 @@
|
||||||
package opts
|
package opts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,8 +18,10 @@ func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *IpOpt) Set(val string) error {
|
func (o *IpOpt) Set(val string) error {
|
||||||
// FIXME: return a parse error if the value is not a valid IP?
|
ip := net.ParseIP(val)
|
||||||
// We are not changing this now to preserve behavior while refactoring.
|
if ip == nil {
|
||||||
|
return fmt.Errorf("incorrect IP format")
|
||||||
|
}
|
||||||
(*o.IP) = net.ParseIP(val)
|
(*o.IP) = net.ParseIP(val)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue