parseCommaSeparatedIDs splits a comma-separated string into a slice of trimmed IDs. An empty string returns an empty slice (used to clear the field).
(raw string)
| 437 | // parseCommaSeparatedIDs splits a comma-separated string into a slice of trimmed IDs. |
| 438 | // An empty string returns an empty slice (used to clear the field). |
| 439 | func parseCommaSeparatedIDs(raw string) []string { |
| 440 | if raw == "" { |
| 441 | return []string{} |
| 442 | } |
| 443 | parts := strings.Split(raw, ",") |
| 444 | var ids []string |
| 445 | for _, p := range parts { |
| 446 | p = strings.TrimSpace(p) |
| 447 | if p != "" { |
| 448 | ids = append(ids, p) |
| 449 | } |
| 450 | } |
| 451 | return ids |
| 452 | } |
| 453 | |
| 454 | // validateDependencies checks that all dependency IDs exist and that |
| 455 | // setting them would not create a circular dependency. |