extractAnnotations extracts the annotations from the flag and returns a map the expected input format is key=value
(annotationsFlag []string)
| 107 | // extractAnnotations extracts the annotations from the flag and returns a map |
| 108 | // the expected input format is key=value |
| 109 | func extractAnnotations(annotationsFlag []string) (map[string]string, error) { |
| 110 | var annotations = make(map[string]string) |
| 111 | for _, annotation := range annotationsFlag { |
| 112 | kv := strings.SplitN(annotation, "=", 2) |
| 113 | if len(kv) < 2 { |
| 114 | return nil, fmt.Errorf("invalid annotation %q, the format must be key=value", annotation) |
| 115 | } |
| 116 | annotations[kv[0]] = kv[1] |
| 117 | } |
| 118 | |
| 119 | return annotations, nil |
| 120 | } |
no outgoing calls