/usr/share/gocode/src/github.com/coreos/pkg/flagutil/types.go is in golang-github-coreos-pkg-dev 0.0~git20151028.0.2c77715-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package flagutil
import (
"errors"
"fmt"
"net"
"strings"
)
// IPv4Flag parses a string into a net.IP after asserting that it
// is an IPv4 address. This type implements the flag.Value interface.
type IPv4Flag struct {
val net.IP
}
func (f *IPv4Flag) IP() net.IP {
return f.val
}
func (f *IPv4Flag) Set(v string) error {
ip := net.ParseIP(v)
if ip == nil || ip.To4() == nil {
return errors.New("not an IPv4 address")
}
f.val = ip
return nil
}
func (f *IPv4Flag) String() string {
return f.val.String()
}
// StringSliceFlag parses a comma-delimited list of strings into
// a []string. This type implements the flag.Value interface.
type StringSliceFlag []string
func (ss *StringSliceFlag) String() string {
return fmt.Sprintf("%+v", *ss)
}
func (ss *StringSliceFlag) Set(v string) error {
*ss = strings.Split(v, ",")
return nil
}
|