1
0
Fork 0
mirror of https://github.com/vbatts/merkle.git synced 2024-12-24 12:36:31 +00:00

stream: write error to stderr instead

This commit is contained in:
Vincent Batts 2015-08-16 19:12:32 -04:00
parent a03956b35e
commit 499faa7234

View file

@ -1,8 +1,9 @@
package merkle
import (
"fmt"
"hash"
"log"
"os"
"runtime"
)
@ -102,7 +103,7 @@ func (mh *merkleHash) Sum(b []byte) []byte {
// :-\
sBuf := make([]byte, 1024)
runtime.Stack(sBuf, false)
log.Printf("[ERROR]: %s %q", err, string(sBuf))
fmt.Fprintf(os.Stderr, "[ERROR]: %s %q", err, string(sBuf))
return nil
}
mh.tree.Nodes = append(mh.tree.Nodes, n)
@ -117,7 +118,7 @@ func (mh *merkleHash) Sum(b []byte) []byte {
if err != nil {
sBuf := make([]byte, 1024)
runtime.Stack(sBuf, false)
log.Printf("[ERROR]: %s %q", err, string(sBuf))
fmt.Fprintf(os.Stderr, "[ERROR]: %s %q", err, string(sBuf))
return nil
}
mh.tree.Nodes = append(mh.tree.Nodes, n)
@ -130,7 +131,7 @@ func (mh *merkleHash) Sum(b []byte) []byte {
// :-\
sBuf := make([]byte, 1024)
runtime.Stack(sBuf, false)
log.Printf("[ERROR]: %s %q", err, string(sBuf))
fmt.Fprintf(os.Stderr, "[ERROR]: %s %q", err, string(sBuf))
return nil
}
return sum