Skip to content

Commit e0f5361

Browse files
committed
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
1 parent 3737979 commit e0f5361

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

internal/buffer/buffer.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -654,22 +654,13 @@ func calcHash(b *Buffer, out *[md5.Size]byte) error {
654654

655655
size := 0
656656
if len(b.lines) > 0 {
657-
n, e := h.Write(b.lines[0].data)
658-
if e != nil {
659-
return e
660-
}
657+
n, _ := h.Write(b.lines[0].data)
661658
size += n
662659

663660
for _, l := range b.lines[1:] {
664-
n, e = h.Write([]byte{'\n'})
665-
if e != nil {
666-
return e
667-
}
661+
n, _ = h.Write([]byte{'\n'})
668662
size += n
669-
n, e = h.Write(l.data)
670-
if e != nil {
671-
return e
672-
}
663+
n, _ = h.Write(l.data)
673664
size += n
674665
}
675666
}

0 commit comments

Comments
 (0)