Validate checks whether all names and values in the label set are valid.
()
| 30 | // Validate checks whether all names and values in the label set |
| 31 | // are valid. |
| 32 | func (ls LabelSet) Validate() error { |
| 33 | for ln, lv := range ls { |
| 34 | if !ln.IsValid() { |
| 35 | return fmt.Errorf("invalid name %q", ln) |
| 36 | } |
| 37 | if !lv.IsValid() { |
| 38 | return fmt.Errorf("invalid value %q", lv) |
| 39 | } |
| 40 | } |
| 41 | return nil |
| 42 | } |
| 43 | |
| 44 | // Equal returns true iff both label sets have exactly the same key/value pairs. |
| 45 | func (ls LabelSet) Equal(o LabelSet) bool { |