X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=dot.go;h=33f5d85a09727eacd2007b9e7c55597e980356e9;hb=ae56a3b66db9f60612f656b0046427ef139c2119;hp=d59bc408a02d3c772a500bce5a98f3ecce44c9ce;hpb=67e92d5a298516292bbbee1f7714708cdc0766f8;p=goredo.git diff --git a/dot.go b/dot.go index d59bc40..33f5d85 100644 --- a/dot.go +++ b/dot.go @@ -1,6 +1,6 @@ /* -goredo -- redo implementation on pure Go -Copyright (C) 2020 Sergey Matveev +goredo -- djb's redo implementation on pure Go +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 @@ -20,6 +20,7 @@ along with this program. If not, see . package main import ( + "errors" "fmt" "io" "os" @@ -46,7 +47,7 @@ func dotWalker(data map[DotNodes]bool, tgtOrig string) (map[DotNodes]bool, error for { m, err := r.NextMap() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { break } return nil, err @@ -56,8 +57,11 @@ func dotWalker(data map[DotNodes]bool, tgtOrig string) (map[DotNodes]bool, error data[DotNodes{tgtOrig, cwdMustRel(cwd, m["Target"])}] = true case DepTypeIfchange: dep = m["Target"] + if dep == tgt { + continue + } data[DotNodes{tgtOrig, cwdMustRel(cwd, dep)}] = false - if isSrc(cwd, dep) || dep == tgt { + if isSrc(cwd, dep) { continue } data, err = dotWalker(data, cwdMustRel(cwd, dep))