]> Cypherpunks.ru repositories - goredo.git/blobdiff - sources.go
Redundant @documentencoding
[goredo.git] / sources.go
index 0d361900527ca0aa1710e2daa7c96e8478075871..f57dbaf3b37f49324ec5a54dac3008051dad16ff 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-2023 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
@@ -18,6 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
+       "log"
        "os"
        "path"
        "path/filepath"
@@ -33,10 +34,16 @@ func sourcesWalker(tgts []string) ([]string, error) {
                cwd, f := path.Split(path.Join(Cwd, tgt))
                fdDep, err := os.Open(path.Join(cwd, RedoDir, f+DepSuffix))
                if err != nil {
+                       if os.IsNotExist(err) {
+                               continue
+                       }
                        return nil, err
                }
                depInfo, err := depRead(fdDep)
                fdDep.Close()
+               if err != nil {
+                       return nil, err
+               }
                for _, m := range depInfo.ifchanges {
                        depTgt := m["Target"]
                        depTgtAbsPath, err := filepath.Abs(path.Join(cwd, depTgt))
@@ -48,7 +55,7 @@ func sourcesWalker(tgts []string) ([]string, error) {
                        } else if depTgtAbsPath != tgtAbsPath {
                                subSrcs, err := sourcesWalker([]string{cwdMustRel(depTgtAbsPath)})
                                if err != nil {
-                                       panic(err)
+                                       log.Fatalln(err)
                                }
                                for _, p := range subSrcs {
                                        seen[p] = struct{}{}