]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Storage optimisations for the same often used data
[goredo.git] / run.go
diff --git a/run.go b/run.go
index 903a063c283b53136eb5475ac15f5d05c9a6388e..7a6ac37ed124474f787ccf7b1ef267e909529d46 100644 (file)
--- a/run.go
+++ b/run.go
@@ -21,7 +21,6 @@ package main
 
 import (
        "bufio"
-       "bytes"
        "crypto/rand"
        "encoding/hex"
        "errors"
@@ -134,7 +133,7 @@ func mkdirs(pth string) error {
 }
 
 func isModified(depInfo *DepInfo, tgt *Tgt) (
-       modified bool, ourInode *Inode, hshPrev []byte, err error,
+       modified bool, ourInode *Inode, hshPrev string, err error,
 ) {
        if depInfo == nil {
                return
@@ -355,7 +354,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                }
        }
 
-       if err = depWrite(fdDep, tgt.h, doFile, nil); err != nil {
+       if err = depWrite(fdDep, tgt.h, doFile, ""); err != nil {
                cleanup()
                return TgtError{tgt, ErrLine(err)}
        }
@@ -722,8 +721,8 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                goto Finish
                        }
                } else {
-                       var hsh []byte
-                       if hshPrev != nil {
+                       var hsh string
+                       if hshPrev != "" {
                                _, err = fd.Seek(0, io.SeekStart)
                                if err != nil {
                                        err = ErrLine(err)
@@ -734,7 +733,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                        err = ErrLine(err)
                                        goto Finish
                                }
-                               if bytes.Equal(hsh, hshPrev) {
+                               if hsh == hshPrev {
                                        tracef(CDebug, "%s has same hash, not renaming", tgt)
                                        err = ErrLine(os.Remove(fd.Name()))
                                        if err != nil {