X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=sources.go;h=6a925e24dc6c2b4318da1bf73e7f7afa25a87dd6;hb=HEAD;hp=246c124ddfd1ecbc11a8a368a9115d342925045b;hpb=af40222f5a3e6fa82207f7ba31c338eb44566ba3;p=goredo.git diff --git a/sources.go b/sources.go index 246c124..6a925e2 100644 --- a/sources.go +++ b/sources.go @@ -1,19 +1,17 @@ -/* -goredo -- djb's redo implementation on pure Go -Copyright (C) 2020-2023 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 -the Free Software Foundation, version 3 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ +// goredo -- djb's redo implementation on pure Go +// Copyright (C) 2020-2024 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 +// the Free Software Foundation, version 3 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . package main @@ -33,23 +31,23 @@ func sourcesWalker( continue } seenDeps[tgt.rel] = struct{}{} - depInfo, err := depRead(tgt) + dep, err := depRead(tgt) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } return ErrLine(err) } - for _, dep := range depInfo.ifchanges { - if _, ok := seen[dep.tgt.rel]; ok { + for _, ifchange := range dep.ifchanges { + if _, ok := seen[ifchange.tgt.rel]; ok { continue } - seen[dep.tgt.rel] = struct{}{} - if isSrc(dep.tgt) { - srcs[dep.tgt.rel] = dep.tgt - } else if dep.tgt.rel != tgt.rel { + seen[ifchange.tgt.rel] = struct{}{} + if isSrc(ifchange.tgt) { + srcs[ifchange.tgt.rel] = ifchange.tgt + } else if ifchange.tgt.rel != tgt.rel { if err := sourcesWalker( - []*Tgt{dep.tgt}, + []*Tgt{ifchange.tgt}, seen, seenDeps, srcs, ); err != nil { return err