From 7d55dd69e3a481fa9885c5fe922c1606bbd928f4 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 2 Feb 2022 01:53:10 -0500 Subject: internal/feed/meta.go: add comment about copy() return value --- internal/feed/meta.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/feed/meta.go b/internal/feed/meta.go index cb7d7a5..fd46025 100644 --- a/internal/feed/meta.go +++ b/internal/feed/meta.go @@ -86,7 +86,9 @@ func NewMeta(r io.Reader) (*Meta, error) { // save to buffer, check for error len := copy(m.Sha256[:], buf[0:32]) if len != 32 { - return nil, fmt.Errorf("invalid sha256 hash copy length: %d", len) + // difficult to test, but this basically doesn't happen, see here: + // https://github.com/golang/go/blob/2ebe77a2fda1ee9ff6fd9a3e08933ad1ebaea039/src/runtime/slice.go#L247 + return nil, fmt.Errorf("invalid copy length: %d", len) } default: // return error -- cgit v1.2.3