MCPcopy
hub / github.com/spf13/pflag / GetIPSlice

Method GetIPSlice

ip_slice.go:132–138  ·  view source on GitHub ↗

GetIPSlice returns the []net.IP value of a flag with the given name

(name string)

Source from the content-addressed store, hash-verified

130
131// GetIPSlice returns the []net.IP value of a flag with the given name
132func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) {
133 val, err := f.getFlagType(name, "ipSlice", ipSliceConv)
134 if err != nil {
135 return []net.IP{}, err
136 }
137 return val.([]net.IP), nil
138}
139
140// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string.
141// The argument p points to a []net.IP variable in which to store the value of the flag.

Callers 3

TestEmptyIPFunction · 0.80
TestIPSDefaultFunction · 0.80
TestIPSWithDefaultFunction · 0.80

Calls 1

getFlagTypeMethod · 0.95

Tested by 3

TestEmptyIPFunction · 0.64
TestIPSDefaultFunction · 0.64
TestIPSWithDefaultFunction · 0.64