bumpo compose-go to v2.1.0

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours
2024-04-23 10:28:28 +02:00
parent 699fa43f7f
commit e3e16ad088
29 changed files with 146 additions and 66 deletions

View File

@ -50,8 +50,8 @@ func (g *graph[T]) checkCycle() error {
func searchCycle[T any](path []string, v *vertex[T]) error {
names := utils.MapKeys(v.children)
for _, name := range names {
if i := slices.Index(path, name); i > 0 {
return fmt.Errorf("dependency cycle detected: %s", strings.Join(path[i:], " -> "))
if i := slices.Index(path, name); i >= 0 {
return fmt.Errorf("dependency cycle detected: %s -> %s", strings.Join(path[i:], " -> "), name)
}
ch := v.children[name]
err := searchCycle(append(path, name), ch)