discovery/zookeeper/zookeeper.go
func (c *ServersetSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
	*c = DefaultServersetSDConfig
	type plain ServersetSDConfig
	err := unmarshal((*plain)(c))
	if err != nil {
		return err
	}
	if len(c.Servers) == 0 {
		return errors.New("serverset SD config must contain at least one Zookeeper server")
	}
	if len(c.Paths) == 0 {
		return errors.New("serverset SD config must contain at least one path")
	}
	for _, path := range c.Paths {
		if !strings.HasPrefix(path, "/") {
			return errors.Errorf("serverset SD config paths must begin with '/': %s", path)
		}
	}
	return nil
}
func (c *ServersetSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
	*c = DefaultServersetSDConfig
	type plain ServersetSDConfig
	err := unmarshal((*plain)(c))
	if err != nil {
		return err
	}
	if len(c.Servers) == 0 {
		return errors.New("serverset SD config must contain at least one Zookeeper server")
	}
	if len(c.Paths) == 0 {
		return errors.New("serverset SD config must contain at least one path")
	}
	for _, path := range c.Paths {
		if !strings.HasPrefix(path, "/") {
			return errors.Errorf("serverset SD config paths must begin with '/': %s", path)
		}
	}
	return nil
}
func ( c * ServersetSDConfig ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { * c = DefaultServersetSDConfig type plain ServersetSDConfig err := unmarshal ( ( * plain ) ( c ) ) if err != nil { return err } if len ( c . Servers ) == 0 { return errors . New ( " " ) } if len ( c . Paths ) == 0 { return errors . New ( " " ) } for _ , path := range c . Paths { if ! strings . HasPrefix ( path , " " ) { return errors . Errorf ( " " , path ) } } return nil }
// UnmarshalYAML implements the yaml.Unmarshaler interface.
UnmarshalYAML implements the yaml . Unmarshaler interface .