Skip to content

Commit

Permalink
blob/all: Don't require SetIOFSCallback to use io/fs.FS functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vangent committed Aug 21, 2024
1 parent d2adbc5 commit 1da8162
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 0 additions & 3 deletions blob/blob_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down
1 change: 0 additions & 1 deletion blob/blob_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1da8162

Please sign in to comment.