From 1da8162db236a65fe978b9ab0a522eb63d9f79d7 Mon Sep 17 00:00:00 2001 From: Robert van Gent Date: Wed, 21 Aug 2024 05:36:38 +0000 Subject: [PATCH] blob/all: Don't require SetIOFSCallback to use io/fs.FS functions --- blob/blob.go | 1 + blob/blob_fs.go | 3 --- blob/blob_fs_test.go | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/blob/blob.go b/blob/blob.go index 162b518920..8eacaad83a 100644 --- a/blob/blob.go +++ b/blob/blob.go @@ -694,6 +694,7 @@ var NewBucket = newBucket func newBucket(b driver.Bucket) *Bucket { return &Bucket{ b: b, + ioFSCallback: func() (context.Context, *ReaderOptions) { return context.Background(), nil }, tracer: &oc.Tracer{ Package: pkgName, Provider: oc.ProviderName(b), diff --git a/blob/blob_fs.go b/blob/blob_fs.go index 3b75a8e31f..eb4c6151eb 100644 --- a/blob/blob_fs.go +++ b/blob/blob_fs.go @@ -166,9 +166,6 @@ func (b *Bucket) SetIOFSCallback(fn func() (context.Context, *ReaderOptions)) { // // SetIOFSCallback must be called prior to calling this function. func (b *Bucket) Open(path string) (fs.File, error) { - if b.ioFSCallback == nil { - return nil, gcerr.Newf(gcerr.InvalidArgument, nil, "blob: Open -- SetIOFSCallback must be called before Open") - } if !fs.ValidPath(path) { return nil, &fs.PathError{Op: "open", Path: path, Err: fs.ErrInvalid} } diff --git a/blob/blob_fs_test.go b/blob/blob_fs_test.go index 8fe820c43a..a1ab0cae8e 100644 --- a/blob/blob_fs_test.go +++ b/blob/blob_fs_test.go @@ -42,7 +42,6 @@ func initBucket(t *testing.T, files []string) *blob.Bucket { ctx := context.Background() b := memblob.OpenBucket(nil) - b.SetIOFSCallback(func() (context.Context, *blob.ReaderOptions) { return ctx, nil }) for _, f := range files { if err := b.WriteAll(ctx, f, []byte("data"), nil); err != nil { t.Fatal(err)