From 2e72fc84769c34fac239a6cf8c29a4adf82bb52b Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Sat, 30 Apr 2022 23:15:11 +0100 Subject: [PATCH] Fix folderReadCloser struct embedding --- struct.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/struct.go b/struct.go index 1c1f222..9b3557b 100644 --- a/struct.go +++ b/struct.go @@ -131,16 +131,8 @@ func (f *folder) coderReader(readers []io.ReadCloser, coder uint64, password str } type folderReadCloser struct { - rc io.ReadCloser - h hash.Hash -} - -func (rc *folderReadCloser) Read(p []byte) (int, error) { - return rc.rc.Read(p) -} - -func (rc *folderReadCloser) Close() error { - return rc.rc.Close() + io.ReadCloser + h hash.Hash } func (rc *folderReadCloser) Checksum() []byte { @@ -150,7 +142,7 @@ func (rc *folderReadCloser) Checksum() []byte { func newFolderReadCloser(rc io.ReadCloser) io.ReadCloser { nrc := new(folderReadCloser) nrc.h = crc32.NewIEEE() - nrc.rc = plumbing.TeeReadCloser(rc, nrc.h) + nrc.ReadCloser = plumbing.TeeReadCloser(rc, nrc.h) return nrc }