(startKind, startVersion, endKind, endVersion string)
| 232 | } |
| 233 | |
| 234 | func (m *Migrator) validatePathInternal(startKind, startVersion, endKind, endVersion string) error { |
| 235 | currKey := makeKey(startKind, startVersion) |
| 236 | targetKey := makeKey(endKind, endVersion) |
| 237 | visited := make(map[string]bool) |
| 238 | |
| 239 | for currKey != targetKey { |
| 240 | if visited[currKey] { |
| 241 | return fmt.Errorf("%w: at %q", ErrMigrationCycle, currKey) |
| 242 | } |
| 243 | visited[currKey] = true |
| 244 | |
| 245 | nextKey, exists := m.pathGraph[currKey] |
| 246 | if !exists { |
| 247 | return fmt.Errorf("%w: broken chain at %q (target: %q)", ErrMigrationPathNotFound, currKey, targetKey) |
| 248 | } |
| 249 | currKey = nextKey |
| 250 | } |
| 251 | |
| 252 | return nil |
| 253 | } |
| 254 | |
| 255 | func makeKey(kind, version string) string { |
| 256 | return fmt.Sprintf("%s:%s", kind, version) |
no test coverage detected