]> Cypherpunks.ru repositories - goredo.git/blobdiff - targets.go
Raised copyright years
[goredo.git] / targets.go
index bc8edfd6d0b00669f1d48a8491034ddef151bda0..af4e4dae9326410a9d0754bcb7851e53f5605e30 100644 (file)
@@ -1,6 +1,6 @@
 /*
 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
@@ -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)
+       }
+}