X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=targets.go;h=af4e4dae9326410a9d0754bcb7851e53f5605e30;hb=f0f007ed9bb046289965d2a7e64f215e4a50a441;hp=bc8edfd6d0b00669f1d48a8491034ddef151bda0;hpb=cb183690cc59ad772dab941adc3e9b8d5b90fbc0;p=goredo.git diff --git a/targets.go b/targets.go index bc8edfd..af4e4da 100644 --- a/targets.go +++ b/targets.go @@ -1,6 +1,6 @@ /* goredo -- djb's redo implementation on pure Go -Copyright (C) 2020-2021 Sergey Matveev +Copyright (C) 2020-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ func targetsCollect(root string, tgts map[string]struct{}) error { } func targetsWalker(tgts []string) ([]string, error) { - tgtsMap := make(map[string]struct{}, 0) + tgtsMap := map[string]struct{}{} for _, tgt := range tgts { if err := targetsCollect(tgt, tgtsMap); err != nil { return nil, err @@ -88,3 +88,14 @@ func targetsWalker(tgts []string) ([]string, error) { } return tgts, nil } + +func collectWholeDeps( + tgts map[string]struct{}, + deps map[string]map[string]struct{}, + seen map[string]struct{}, +) { + for tgt := range tgts { + seen[tgt] = struct{}{} + collectWholeDeps(deps[tgt], deps, seen) + } +}