mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-17 06:20:28 +00:00
calcHash: remove unneeded h.Write() error checks
According to the Go hash package documentation [1]:
type Hash interface {
// Write (via the embedded io.Writer interface) adds more data to the running hash.
// It never returns an error.
io.Writer
[1] https://pkg.go.dev/hash#Hash
This commit is contained in:
parent
3737979139
commit
e0f5361d97
1 changed files with 3 additions and 12 deletions
|
|
@ -654,22 +654,13 @@ func calcHash(b *Buffer, out *[md5.Size]byte) error {
|
|||
|
||||
size := 0
|
||||
if len(b.lines) > 0 {
|
||||
n, e := h.Write(b.lines[0].data)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
n, _ := h.Write(b.lines[0].data)
|
||||
size += n
|
||||
|
||||
for _, l := range b.lines[1:] {
|
||||
n, e = h.Write([]byte{'\n'})
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
n, _ = h.Write([]byte{'\n'})
|
||||
size += n
|
||||
n, e = h.Write(l.data)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
n, _ = h.Write(l.data)
|
||||
size += n
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue