/*
goredo -- djb's redo implementation on pure Go
-Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2020-2022 Sergey Matveev <stargrave@stargrave.org>
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
}
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
}
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)
+ }
+}