package opts

import (
	"fmt"
	"net"
)

type IpOpt struct {
	*net.IP
}

func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
	o := &IpOpt{
		IP: ref,
	}
	o.Set(defaultVal)
	return o
}

func (o *IpOpt) Set(val string) error {
	ip := net.ParseIP(val)
	if ip == nil {
		return fmt.Errorf("%s is not an ip address", val)
	}
	(*o.IP) = net.ParseIP(val)
	return nil
}

func (o *IpOpt) String() string {
	return (*o.IP).String()
}

package opts

import (
	"fmt"
	"net"
)

type IpOpt struct {
	*net.IP
}

func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
	o := &IpOpt{
		IP: ref,
	}
	o.Set(defaultVal)
	return o
}

func (o *IpOpt) Set(val string) error {
	ip := net.ParseIP(val)
	if ip == nil {
		return fmt.Errorf("%s is not an ip address", val)
	}
	*o.IP = ip
	return nil
}

func (o *IpOpt) String() string {
	return o.IP.String()
}

Remove duplicate call to net.ParseIP and a little cleanup
Remove duplicate call to net.ParseIP
and a little cleanup

Signed-off-by: Doug Davis <ff3bde741799c0eff815b83a54eda3fc494df54f@us.ibm.com>
(cherry picked from commit b180de55caa382fd6ced4488d68392edd1d34da0)
