]> Cypherpunks.ru repositories - goredo.git/blobdiff - sources.go
DRY filepath.Abs/Rel
[goredo.git] / sources.go
index b7dcfd473d0add22302afd8560972b7000feb64c..659df3a51d9ff76e352dcbc104b62e7d01a8be6b 100644 (file)
@@ -21,16 +21,12 @@ import (
        "log"
        "os"
        "path"
-       "path/filepath"
 )
 
 func sourcesWalker(tgts []string) ([]string, error) {
        seen := make(map[string]struct{}, 1<<10)
        for _, tgt := range tgts {
-               tgtAbsPath, err := filepath.Abs(path.Join(Cwd, tgt))
-               if err != nil {
-                       panic(err)
-               }
+               tgtAbsPath := mustAbs(path.Join(Cwd, tgt))
                cwd, f := path.Split(path.Join(Cwd, tgt))
                fdDep, err := os.Open(path.Join(cwd, RedoDir, f+DepSuffix))
                if err != nil {
@@ -46,10 +42,7 @@ func sourcesWalker(tgts []string) ([]string, error) {
                }
                for _, m := range depInfo.ifchanges {
                        depTgt := m["Target"]
-                       depTgtAbsPath, err := filepath.Abs(path.Join(cwd, depTgt))
-                       if err != nil {
-                               panic(err)
-                       }
+                       depTgtAbsPath := mustAbs(path.Join(cwd, depTgt))
                        if isSrc(cwd, depTgt) {
                                seen[cwdMustRel(depTgtAbsPath)] = struct{}{}
                        } else if depTgtAbsPath != tgtAbsPath {