mirror of
https://github.com/vbatts/merkle.git
synced 2024-11-27 08:45:39 +00:00
stream: write error to stderr instead
This commit is contained in:
parent
a03956b35e
commit
499faa7234
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue