(data map[string]map[string]bool)
| 142 | } |
| 143 | |
| 144 | func validateRequiredFlagGroups(data map[string]map[string]bool) error { |
| 145 | keys := sortedKeys(data) |
| 146 | for _, flagList := range keys { |
| 147 | flagnameAndStatus := data[flagList] |
| 148 | |
| 149 | unset := []string{} |
| 150 | for flagname, isSet := range flagnameAndStatus { |
| 151 | if !isSet { |
| 152 | unset = append(unset, flagname) |
| 153 | } |
| 154 | } |
| 155 | if len(unset) == len(flagnameAndStatus) || len(unset) == 0 { |
| 156 | continue |
| 157 | } |
| 158 | |
| 159 | // Sort values, so they can be tested/scripted against consistently. |
| 160 | sort.Strings(unset) |
| 161 | return fmt.Errorf("if any flags in the group [%v] are set they must all be set; missing %v", flagList, unset) |
| 162 | } |
| 163 | |
| 164 | return nil |
| 165 | } |
| 166 | |
| 167 | func validateOneRequiredFlagGroups(data map[string]map[string]bool) error { |
| 168 | keys := sortedKeys(data) |
no test coverage detected
searching dependent graphs…