diff --git a/src/restic/backend/mem/mem_backend.go b/src/restic/backend/mem/mem_backend.go index bbb4dbd1a..6c3296604 100644 --- a/src/restic/backend/mem/mem_backend.go +++ b/src/restic/backend/mem/mem_backend.go @@ -8,7 +8,6 @@ import ( "restic" "sync" - "restic/backend" "restic/errors" "restic/debug" @@ -114,7 +113,7 @@ func (be *MemoryBackend) Load(ctx context.Context, h restic.Handle, length int, buf = buf[:length] } - return backend.Closer{Reader: bytes.NewReader(buf)}, nil + return ioutil.NopCloser(bytes.NewReader(buf)), nil } // Stat returns information about a file in the backend. diff --git a/src/restic/backend/rest/rest.go b/src/restic/backend/rest/rest.go index 4145a2a32..337d8584c 100644 --- a/src/restic/backend/rest/rest.go +++ b/src/restic/backend/rest/rest.go @@ -108,9 +108,8 @@ func (b *restBackend) Save(ctx context.Context, h restic.Handle, rd io.Reader) ( ctx, cancel := context.WithCancel(ctx) defer cancel() - // make sure that client.Post() cannot close the reader by wrapping it in - // backend.Closer, which has a noop method. - rd = backend.Closer{Reader: rd} + // make sure that client.Post() cannot close the reader by wrapping it + rd = ioutil.NopCloser(rd) b.sem.GetToken() resp, err := ctxhttp.Post(ctx, b.client, b.Filename(h), "binary/octet-stream", rd) diff --git a/src/restic/backend/utils.go b/src/restic/backend/utils.go index a07c7e86e..76e9de569 100644 --- a/src/restic/backend/utils.go +++ b/src/restic/backend/utils.go @@ -29,16 +29,6 @@ func LoadAll(ctx context.Context, be restic.Backend, h restic.Handle) (buf []byt return ioutil.ReadAll(rd) } -// Closer wraps an io.Reader and adds a Close() method that does nothing. -type Closer struct { - io.Reader -} - -// Close is a no-op. -func (c Closer) Close() error { - return nil -} - // LimitedReadCloser wraps io.LimitedReader and exposes the Close() method. type LimitedReadCloser struct { io.ReadCloser