(ctx context.Context, desc string, val *[]string, add, remove []string, clearList bool, changeCount *int)
| 149 | } |
| 150 | |
| 151 | func applyPolicyStringList(ctx context.Context, desc string, val *[]string, add, remove []string, clearList bool, changeCount *int) { |
| 152 | if clearList { |
| 153 | log(ctx).Infof(" - removing all from %q", desc) |
| 154 | |
| 155 | *changeCount++ |
| 156 | |
| 157 | *val = nil |
| 158 | |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | entries := map[string]bool{} |
| 163 | for _, b := range *val { |
| 164 | entries[b] = true |
| 165 | } |
| 166 | |
| 167 | for _, b := range add { |
| 168 | *changeCount++ |
| 169 | |
| 170 | log(ctx).Infof(" - adding %q to %q", b, desc) |
| 171 | |
| 172 | entries[b] = true |
| 173 | } |
| 174 | |
| 175 | for _, b := range remove { |
| 176 | *changeCount++ |
| 177 | |
| 178 | log(ctx).Infof(" - removing %q from %q", b, desc) |
| 179 | delete(entries, b) |
| 180 | } |
| 181 | |
| 182 | var s []string |
| 183 | for k := range entries { |
| 184 | s = append(s, k) |
| 185 | } |
| 186 | |
| 187 | sort.Strings(s) |
| 188 | |
| 189 | *val = s |
| 190 | } |
| 191 | |
| 192 | func applyOptionalInt(ctx context.Context, desc string, val **policy.OptionalInt, str string, changeCount *int) error { |
| 193 | if str == "" { |
no outgoing calls
no test coverage detected
searching dependent graphs…