Skip to content

Commit 9a3d766

Browse files
committed
apply Vojtech suggestions - 2
1 parent faba6db commit 9a3d766

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type Options struct {
8080
}
8181

8282
func (o Options) WithDefaults() Options {
83-
o.FileSystem = cmp.Or(o.FileSystem, local.NewLocalFS(""))
83+
o.FileSystem = cmp.Or(o.FileSystem, storage.FS(local.NewLocalFS("")))
8484
o.FilePrefetchTimeout = cmp.Or(o.FilePrefetchTimeout, defaultPrefetchTimeout)
8585
o.FileRollPolicy = cmp.Or(o.FileRollPolicy, NewFileSizeRollPolicy(uint64(defaultFileSize)))
8686
if o.NewEncoder == nil {
@@ -226,7 +226,7 @@ func (f *File) open(ctx context.Context, fs storage.FS) (io.ReadCloser, error) {
226226
}
227227

228228
file, err := fs.Open(ctx, f.legacyPath(), nil)
229-
if err != nil && strings.Contains(err.Error(), "not exist") {
229+
if err != nil && storage.IsNotExist(err) {
230230
return nil, ErrFileNotExist
231231
}
232232
if err != nil {

storage/errors.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package storage
2+
3+
import "github.com/Shopify/go-storage"
4+
5+
func IsNotExist(err error) bool {
6+
return storage.IsNotExist(err)
7+
}

writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func NewWriter[T any](opt Options) (Writer[T], error) {
8888
firstBlockNum: lastBlockNum + 1,
8989
lastBlockNum: lastBlockNum,
9090
fileIndex: fileIndex,
91-
buffer: bytes.NewBuffer(make([]byte, 0, defaultBufferSize)),
91+
buffer: bytes.NewBuffer(make([]byte, 0, defaultFileSize)),
9292
}, nil
9393
}
9494

0 commit comments

Comments
 (0)