From e5be471ce035dfe22df13db28254240c6413c4b2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 6 Apr 2018 19:53:06 +0100 Subject: [PATCH] Use io.SeekStart/End/Current constants now for go1.7+ #2154 --- backend/cache/cache_internal_test.go | 4 ++-- backend/cache/handle.go | 11 +++++------ backend/cache/object.go | 3 +-- backend/crypt/cipher.go | 4 ++-- backend/crypt/cipher_test.go | 4 ++-- backend/drive/upload.go | 2 +- backend/dropbox/dropbox.go | 6 +++--- backend/local/local.go | 2 +- backend/onedrive/onedrive.go | 2 +- backend/qingstor/upload.go | 6 +++--- backend/sftp/sftp.go | 2 +- cmd/mount/file.go | 3 ++- cmd/mount/test/seek_speed.go | 2 +- cmd/mount/test/seeker.go | 4 ++-- cmd/mount/test/seekers.go | 2 +- cmd/mountlib/mounttest/read.go | 10 +++++----- fs/chunkedreader/chunkedreader.go | 4 ++-- fs/log/log.go | 3 ++- lib/readers/repeatable.go | 6 +++--- lib/readers/repeatable_test.go | 12 ++++++------ vfs/read.go | 6 +++--- vfs/read_test.go | 10 +++++----- vfs/read_write_test.go | 16 ++++++++-------- vfs/vfs_test.go | 3 ++- 24 files changed, 64 insertions(+), 63 deletions(-) diff --git a/backend/cache/cache_internal_test.go b/backend/cache/cache_internal_test.go index abf8d55ec..2ff738792 100644 --- a/backend/cache/cache_internal_test.go +++ b/backend/cache/cache_internal_test.go @@ -1526,7 +1526,7 @@ func (r *run) randomReader(t *testing.T, size int64) io.ReadCloser { } data := r.randomBytes(t, int64(left)) _, _ = f.Write(data) - _, _ = f.Seek(int64(0), 0) + _, _ = f.Seek(int64(0), io.SeekStart) r.tempFiles = append(r.tempFiles, f) return f @@ -1653,7 +1653,7 @@ func (r *run) readDataFromRemote(t *testing.T, f fs.Fs, remote string, offset, e if err != nil { return checkSample, err } - _, _ = f.Seek(offset, 0) + _, _ = f.Seek(offset, io.SeekStart) totalRead, err := io.ReadFull(f, checkSample) checkSample = checkSample[:totalRead] if err == io.EOF || err == io.ErrUnexpectedEOF { diff --git a/backend/cache/handle.go b/backend/cache/handle.go index 1556a468c..6152c3826 100644 --- a/backend/cache/handle.go +++ b/backend/cache/handle.go @@ -5,7 +5,6 @@ package cache import ( "fmt" "io" - "os" "sync" "time" @@ -327,13 +326,13 @@ func (r *Handle) Seek(offset int64, whence int) (int64, error) { var err error switch whence { - case os.SEEK_SET: + case io.SeekStart: fs.Debugf(r, "moving offset set from %v to %v", r.offset, offset) r.offset = offset - case os.SEEK_CUR: + case io.SeekCurrent: fs.Debugf(r, "moving offset cur from %v to %v", r.offset, r.offset+offset) r.offset += offset - case os.SEEK_END: + case io.SeekEnd: fs.Debugf(r, "moving offset end (%v) from %v to %v", r.cachedObject.Size(), r.offset, r.cachedObject.Size()+offset) r.offset = r.cachedObject.Size() + offset default: @@ -382,10 +381,10 @@ func (w *worker) reader(offset, end int64, closeOpen bool) (io.ReadCloser, error if !closeOpen { if do, ok := r.(fs.RangeSeeker); ok { - _, err = do.RangeSeek(offset, os.SEEK_SET, end-offset) + _, err = do.RangeSeek(offset, io.SeekStart, end-offset) return r, err } else if do, ok := r.(io.Seeker); ok { - _, err = do.Seek(offset, os.SEEK_SET) + _, err = do.Seek(offset, io.SeekStart) return r, err } } diff --git a/backend/cache/object.go b/backend/cache/object.go index dd5ee03a6..15157d500 100644 --- a/backend/cache/object.go +++ b/backend/cache/object.go @@ -4,7 +4,6 @@ package cache import ( "io" - "os" "path" "sync" "time" @@ -223,7 +222,7 @@ func (o *Object) Open(options ...fs.OpenOption) (io.ReadCloser, error) { case *fs.RangeOption: offset, limit = x.Decode(o.Size()) } - _, err = cacheReader.Seek(offset, os.SEEK_SET) + _, err = cacheReader.Seek(offset, io.SeekStart) if err != nil { return nil, err } diff --git a/backend/crypt/cipher.go b/backend/crypt/cipher.go index 4b1345d5b..ec21a8077 100644 --- a/backend/crypt/cipher.go +++ b/backend/crypt/cipher.go @@ -781,7 +781,7 @@ func (c *cipher) newDecrypterSeek(open OpenRangeSeek, offset, limit int64) (fh * } fh.open = open // will be called by fh.RangeSeek if doRangeSeek { - _, err = fh.RangeSeek(offset, 0, limit) + _, err = fh.RangeSeek(offset, io.SeekStart, limit) if err != nil { _ = fh.Close() return nil, err @@ -908,7 +908,7 @@ func (fh *decrypter) RangeSeek(offset int64, whence int, limit int64) (int64, er if fh.open == nil { return 0, fh.finish(errors.New("can't seek - not initialised with newDecrypterSeek")) } - if whence != 0 { + if whence != io.SeekStart { return 0, fh.finish(errors.New("can only seek from the start")) } diff --git a/backend/crypt/cipher_test.go b/backend/crypt/cipher_test.go index 8b4eb217d..a0a2e2c8f 100644 --- a/backend/crypt/cipher_test.go +++ b/backend/crypt/cipher_test.go @@ -1016,7 +1016,7 @@ func TestNewDecrypterSeekLimit(t *testing.T) { if offset+limit > len(plaintext) { continue } - _, err := fh.RangeSeek(int64(offset), 0, int64(limit)) + _, err := fh.RangeSeek(int64(offset), io.SeekStart, int64(limit)) assert.NoError(t, err) check(fh, offset, limit) @@ -1083,7 +1083,7 @@ func TestNewDecrypterSeekLimit(t *testing.T) { } fh, err := c.DecryptDataSeek(testOpen, 0, -1) assert.NoError(t, err) - gotOffset, err := fh.RangeSeek(test.offset, 0, test.limit) + gotOffset, err := fh.RangeSeek(test.offset, io.SeekStart, test.limit) assert.NoError(t, err) assert.Equal(t, gotOffset, test.offset) } diff --git a/backend/drive/upload.go b/backend/drive/upload.go index 0bf24eb52..7a6d68bdb 100644 --- a/backend/drive/upload.go +++ b/backend/drive/upload.go @@ -159,7 +159,7 @@ func (rx *resumableUpload) transferStatus() (start int64, err error) { // Transfer a chunk - caller must call googleapi.CloseBody(res) if err == nil || res != nil func (rx *resumableUpload) transferChunk(start int64, chunk io.ReadSeeker, chunkSize int64) (int, error) { - _, _ = chunk.Seek(0, 0) + _, _ = chunk.Seek(0, io.SeekStart) req := rx.makeRequest(start, chunk, chunkSize) res, err := rx.f.client.Do(req) if err != nil { diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go index 541837707..0ec60c959 100644 --- a/backend/dropbox/dropbox.go +++ b/backend/dropbox/dropbox.go @@ -894,7 +894,7 @@ func (o *Object) uploadChunked(in0 io.Reader, commitInfo *files.CommitInfo, size chunk := readers.NewRepeatableLimitReaderBuffer(in, buf, chunkSize) err = o.fs.pacer.Call(func() (bool, error) { // seek to the start in case this is a retry - if _, err = chunk.Seek(0, 0); err != nil { + if _, err = chunk.Seek(0, io.SeekStart); err != nil { return false, nil } res, err = o.fs.srv.UploadSessionStart(&files.UploadSessionStartArg{}, chunk) @@ -930,7 +930,7 @@ func (o *Object) uploadChunked(in0 io.Reader, commitInfo *files.CommitInfo, size chunk = readers.NewRepeatableLimitReaderBuffer(in, buf, chunkSize) err = o.fs.pacer.Call(func() (bool, error) { // seek to the start in case this is a retry - if _, err = chunk.Seek(0, 0); err != nil { + if _, err = chunk.Seek(0, io.SeekStart); err != nil { return false, nil } err = o.fs.srv.UploadSessionAppendV2(&appendArg, chunk) @@ -953,7 +953,7 @@ func (o *Object) uploadChunked(in0 io.Reader, commitInfo *files.CommitInfo, size chunk = readers.NewRepeatableReaderBuffer(in, buf) err = o.fs.pacer.Call(func() (bool, error) { // seek to the start in case this is a retry - if _, err = chunk.Seek(0, 0); err != nil { + if _, err = chunk.Seek(0, io.SeekStart); err != nil { return false, nil } entry, err = o.fs.srv.UploadSessionFinish(args, chunk) diff --git a/backend/local/local.go b/backend/local/local.go index 8c61b53a3..935dbecd3 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -732,7 +732,7 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) { wrappedFd := readers.NewLimitedReadCloser(fd, limit) if offset != 0 { // seek the object - _, err = fd.Seek(offset, 0) + _, err = fd.Seek(offset, io.SeekStart) // don't attempt to make checksums return wrappedFd, err } diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index 1e5da9470..d97886f5c 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -1123,7 +1123,7 @@ func (o *Object) uploadFragment(url string, start int64, totalSize int64, chunk // var response api.UploadFragmentResponse var resp *http.Response err = o.fs.pacer.Call(func() (bool, error) { - _, _ = chunk.Seek(0, 0) + _, _ = chunk.Seek(0, io.SeekStart) resp, err = o.fs.srv.Call(&opts) if resp != nil { defer fs.CheckClose(resp.Body, &err) diff --git a/backend/qingstor/upload.go b/backend/qingstor/upload.go index ee98f4650..c5a9f4ca7 100644 --- a/backend/qingstor/upload.go +++ b/backend/qingstor/upload.go @@ -130,12 +130,12 @@ func (u *uploader) init() { u.totalSize = -1 switch r := u.cfg.body.(type) { case io.Seeker: - pos, _ := r.Seek(0, 1) + pos, _ := r.Seek(0, io.SeekCurrent) defer func() { - _, _ = r.Seek(pos, 0) + _, _ = r.Seek(pos, io.SeekStart) }() - n, err := r.Seek(0, 2) + n, err := r.Seek(0, io.SeekEnd) if err != nil { return } diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 21f9bf1f7..c00736035 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -905,7 +905,7 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) { return nil, errors.Wrap(err, "Open failed") } if offset > 0 { - off, err := sftpFile.Seek(offset, 0) + off, err := sftpFile.Seek(offset, io.SeekStart) if err != nil || off != offset { return nil, errors.Wrap(err, "Open Seek failed") } diff --git a/cmd/mount/file.go b/cmd/mount/file.go index 36624518a..29fbbed02 100644 --- a/cmd/mount/file.go +++ b/cmd/mount/file.go @@ -3,6 +3,7 @@ package mount import ( + "io" "time" "bazil.org/fuse" @@ -74,7 +75,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR } // See if seeking is supported and set FUSE hint accordingly - if _, err = handle.Seek(0, 1); err != nil { + if _, err = handle.Seek(0, io.SeekCurrent); err != nil { resp.Flags |= fuse.OpenNonSeekable } diff --git a/cmd/mount/test/seek_speed.go b/cmd/mount/test/seek_speed.go index f23e490a7..390c42497 100644 --- a/cmd/mount/test/seek_speed.go +++ b/cmd/mount/test/seek_speed.go @@ -27,7 +27,7 @@ func randomSeekTest(size int64, in *os.File, name string) { } log.Printf("Reading %d from %d", blockSize, start) - _, err := in.Seek(start, 0) + _, err := in.Seek(start, io.SeekStart) if err != nil { log.Fatalf("Seek failed on %q: %v", name, err) } diff --git a/cmd/mount/test/seeker.go b/cmd/mount/test/seeker.go index 39503bf32..02d144b2c 100644 --- a/cmd/mount/test/seeker.go +++ b/cmd/mount/test/seeker.go @@ -32,11 +32,11 @@ func randomSeekTest(size int64, in1, in2 *os.File, file1, file2 string) { } log.Printf("Reading %d from %d", blockSize, start) - _, err := in1.Seek(start, 0) + _, err := in1.Seek(start, io.SeekStart) if err != nil { log.Fatalf("Seek failed on %q: %v", file1, err) } - _, err = in2.Seek(start, 0) + _, err = in2.Seek(start, io.SeekStart) if err != nil { log.Fatalf("Seek failed on %q: %v", file2, err) } diff --git a/cmd/mount/test/seekers.go b/cmd/mount/test/seekers.go index a33670e51..32fd4d1a7 100644 --- a/cmd/mount/test/seekers.go +++ b/cmd/mount/test/seekers.go @@ -68,7 +68,7 @@ func seekTest(n int, file string) { } log.Printf("%s: Reading %d from %d", file, blockSize, start) - _, err = in.Seek(start, 0) + _, err = in.Seek(start, io.SeekStart) if err != nil { log.Fatalf("Seek failed on %q: %v", file, err) } diff --git a/cmd/mountlib/mounttest/read.go b/cmd/mountlib/mounttest/read.go index 8012e976b..d68616c80 100644 --- a/cmd/mountlib/mounttest/read.go +++ b/cmd/mountlib/mounttest/read.go @@ -66,7 +66,7 @@ func TestReadChecksum(t *testing.T) { _, err = io.ReadFull(fd, buf) assert.NoError(t, err) // read at end - _, err = fd.Seek(int64(len(b)-len(buf)), 0) + _, err = fd.Seek(int64(len(b)-len(buf)), io.SeekStart) assert.NoError(t, err) _, err = io.ReadFull(fd, buf) assert.NoError(t, err) @@ -89,7 +89,7 @@ func TestReadSeek(t *testing.T) { assert.NoError(t, err) // Seek to half way - _, err = fd.Seek(5, 0) + _, err = fd.Seek(5, io.SeekStart) assert.NoError(t, err) buf, err := ioutil.ReadAll(fd) @@ -97,7 +97,7 @@ func TestReadSeek(t *testing.T) { assert.Equal(t, buf, []byte("HELLO")) // Test seeking to the end - _, err = fd.Seek(10, 0) + _, err = fd.Seek(10, io.SeekStart) assert.NoError(t, err) buf, err = ioutil.ReadAll(fd) @@ -105,7 +105,7 @@ func TestReadSeek(t *testing.T) { assert.Equal(t, buf, []byte("")) // Test seeking beyond the end - _, err = fd.Seek(1000000, 0) + _, err = fd.Seek(1000000, io.SeekStart) assert.NoError(t, err) buf, err = ioutil.ReadAll(fd) @@ -113,7 +113,7 @@ func TestReadSeek(t *testing.T) { assert.Equal(t, buf, []byte("")) // Now back to the start - _, err = fd.Seek(0, 0) + _, err = fd.Seek(0, io.SeekStart) assert.NoError(t, err) buf, err = ioutil.ReadAll(fd) diff --git a/fs/chunkedreader/chunkedreader.go b/fs/chunkedreader/chunkedreader.go index 9361771f4..fb135b83d 100644 --- a/fs/chunkedreader/chunkedreader.go +++ b/fs/chunkedreader/chunkedreader.go @@ -107,9 +107,9 @@ func (cr *ChunkedReader) RangeSeek(offset int64, whence int, length int64) (int6 size := cr.o.Size() switch whence { - case 0: + case io.SeekStart: cr.offset = 0 - case 2: + case io.SeekEnd: cr.offset = size } cr.chunkOffset = cr.offset + offset diff --git a/fs/log/log.go b/fs/log/log.go index 0e7908e8f..4bafc0146 100644 --- a/fs/log/log.go +++ b/fs/log/log.go @@ -2,6 +2,7 @@ package log import ( + "io" "log" "os" "reflect" @@ -71,7 +72,7 @@ func InitLogging() { if err != nil { log.Fatalf("Failed to open log file: %v", err) } - _, err = f.Seek(0, os.SEEK_END) + _, err = f.Seek(0, io.SeekEnd) if err != nil { fs.Errorf(nil, "Failed to seek log file to end: %v", err) } diff --git a/lib/readers/repeatable.go b/lib/readers/repeatable.go index ab0073581..f8513637d 100644 --- a/lib/readers/repeatable.go +++ b/lib/readers/repeatable.go @@ -24,11 +24,11 @@ func (r *RepeatableReader) Seek(offset int64, whence int) (int64, error) { var abs int64 cacheLen := int64(len(r.b)) switch whence { - case 0: //io.SeekStart + case io.SeekStart: abs = offset - case 1: //io.SeekCurrent + case io.SeekCurrent: abs = r.i + offset - case 2: //io.SeekEnd + case io.SeekEnd: abs = cacheLen + offset default: return 0, errors.New("fs.RepeatableReader.Seek: invalid whence") diff --git a/lib/readers/repeatable_test.go b/lib/readers/repeatable_test.go index 329880b2e..20c6e5680 100644 --- a/lib/readers/repeatable_test.go +++ b/lib/readers/repeatable_test.go @@ -32,7 +32,7 @@ func TestRepeatableReader(t *testing.T) { // Test Seek Back to start dst = make([]byte, 10) - pos, err = r.Seek(0, 0) + pos, err = r.Seek(0, io.SeekStart) assert.Nil(t, err) require.Equal(t, 0, int(pos)) @@ -58,13 +58,13 @@ func TestRepeatableReader(t *testing.T) { buf = bytes.NewBuffer(b) r = NewRepeatableReader(buf) // Should not allow seek past cache index - pos, err = r.Seek(5, 1) + pos, err = r.Seek(5, io.SeekCurrent) assert.NotNil(t, err) assert.Equal(t, "fs.RepeatableReader.Seek: offset is unavailable", err.Error()) assert.Equal(t, 0, int(pos)) // Should not allow seek to negative position start - pos, err = r.Seek(-1, 1) + pos, err = r.Seek(-1, io.SeekCurrent) assert.NotNil(t, err) assert.Equal(t, "fs.RepeatableReader.Seek: negative position", err.Error()) assert.Equal(t, 0, int(pos)) @@ -78,15 +78,15 @@ func TestRepeatableReader(t *testing.T) { // Should seek from index with io.SeekCurrent(1) whence dst = make([]byte, 5) _, _ = r.Read(dst) - pos, err = r.Seek(-3, 1) + pos, err = r.Seek(-3, io.SeekCurrent) assert.Nil(t, err) require.Equal(t, 2, int(pos)) - pos, err = r.Seek(1, 1) + pos, err = r.Seek(1, io.SeekCurrent) assert.Nil(t, err) require.Equal(t, 3, int(pos)) // Should seek from cache end with io.SeekEnd(2) whence - pos, err = r.Seek(-3, 2) + pos, err = r.Seek(-3, io.SeekEnd) assert.Nil(t, err) require.Equal(t, 2, int(pos)) diff --git a/vfs/read.go b/vfs/read.go index 1e6faf80b..b74f97ce6 100644 --- a/vfs/read.go +++ b/vfs/read.go @@ -110,7 +110,7 @@ func (fh *ReadFileHandle) seek(offset int64, reopen bool) (err error) { // Can we seek it directly? if do, ok := oldReader.(io.Seeker); !reopen && ok { fs.Debugf(fh.remote, "ReadFileHandle.seek from %d to %d (io.Seeker)", fh.offset, offset) - _, err = do.Seek(offset, 0) + _, err = do.Seek(offset, io.SeekStart) if err != nil { fs.Debugf(fh.remote, "ReadFileHandle.Read io.Seeker failed: %v", err) return err @@ -144,9 +144,9 @@ func (fh *ReadFileHandle) Seek(offset int64, whence int) (n int64, err error) { } size := fh.size switch whence { - case 0: + case io.SeekStart: fh.roffset = 0 - case 2: + case io.SeekEnd: fh.roffset = size } fh.roffset += offset diff --git a/vfs/read_test.go b/vfs/read_test.go index 23a2bfd52..a3341546d 100644 --- a/vfs/read_test.go +++ b/vfs/read_test.go @@ -87,25 +87,25 @@ func TestReadFileHandleSeek(t *testing.T) { assert.Equal(t, "0", readString(t, fh, 1)) // 0 means relative to the origin of the file, - n, err := fh.Seek(5, 0) + n, err := fh.Seek(5, io.SeekStart) assert.NoError(t, err) assert.Equal(t, int64(5), n) assert.Equal(t, "5", readString(t, fh, 1)) // 1 means relative to the current offset - n, err = fh.Seek(-3, 1) + n, err = fh.Seek(-3, io.SeekCurrent) assert.NoError(t, err) assert.Equal(t, int64(3), n) assert.Equal(t, "3", readString(t, fh, 1)) // 2 means relative to the end. - n, err = fh.Seek(-3, 2) + n, err = fh.Seek(-3, io.SeekEnd) assert.NoError(t, err) assert.Equal(t, int64(13), n) assert.Equal(t, "d", readString(t, fh, 1)) // Seek off the end - n, err = fh.Seek(100, 0) + n, err = fh.Seek(100, io.SeekStart) assert.NoError(t, err) // Get the error on read @@ -116,7 +116,7 @@ func TestReadFileHandleSeek(t *testing.T) { // Check if noSeek is set we get an error fh.noSeek = true - _, err = fh.Seek(0, 0) + _, err = fh.Seek(0, io.SeekStart) assert.Equal(t, ESPIPE, err) // Close diff --git a/vfs/read_write_test.go b/vfs/read_write_test.go index e13ebcbe9..b42aca7d0 100644 --- a/vfs/read_write_test.go +++ b/vfs/read_write_test.go @@ -123,11 +123,11 @@ func TestRWFileHandleSeek(t *testing.T) { assert.Equal(t, fh.opened, false) // Check null seeks don't open the file - n, err := fh.Seek(0, 0) + n, err := fh.Seek(0, io.SeekStart) assert.NoError(t, err) assert.Equal(t, int64(0), n) assert.Equal(t, fh.opened, false) - n, err = fh.Seek(0, 1) + n, err = fh.Seek(0, io.SeekCurrent) assert.NoError(t, err) assert.Equal(t, int64(0), n) assert.Equal(t, fh.opened, false) @@ -135,25 +135,25 @@ func TestRWFileHandleSeek(t *testing.T) { assert.Equal(t, "0", rwReadString(t, fh, 1)) // 0 means relative to the origin of the file, - n, err = fh.Seek(5, 0) + n, err = fh.Seek(5, io.SeekStart) assert.NoError(t, err) assert.Equal(t, int64(5), n) assert.Equal(t, "5", rwReadString(t, fh, 1)) // 1 means relative to the current offset - n, err = fh.Seek(-3, 1) + n, err = fh.Seek(-3, io.SeekCurrent) assert.NoError(t, err) assert.Equal(t, int64(3), n) assert.Equal(t, "3", rwReadString(t, fh, 1)) // 2 means relative to the end. - n, err = fh.Seek(-3, 2) + n, err = fh.Seek(-3, io.SeekEnd) assert.NoError(t, err) assert.Equal(t, int64(13), n) assert.Equal(t, "d", rwReadString(t, fh, 1)) // Seek off the end - n, err = fh.Seek(100, 0) + n, err = fh.Seek(100, io.SeekStart) assert.NoError(t, err) // Get the error on read @@ -290,7 +290,7 @@ func TestRWFileHandleMethodsWrite(t *testing.T) { assert.Equal(t, "file1", node.Name()) offset := func() int64 { - n, err := fh.Seek(0, 1) + n, err := fh.Seek(0, io.SeekCurrent) require.NoError(t, err) return n } @@ -362,7 +362,7 @@ func TestRWFileHandleWriteAt(t *testing.T) { defer cleanup(t, r, vfs) offset := func() int64 { - n, err := fh.Seek(0, 1) + n, err := fh.Seek(0, io.SeekCurrent) require.NoError(t, err) return n } diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index 7e9ed183a..3bf10a9a0 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -3,6 +3,7 @@ package vfs import ( + "io" "os" "testing" @@ -58,7 +59,7 @@ func TestVFSbaseHandle(t *testing.T) { _, err = fh.Readdirnames(0) assert.Equal(t, ENOSYS, err) - _, err = fh.Seek(0, 0) + _, err = fh.Seek(0, io.SeekStart) assert.Equal(t, ENOSYS, err) _, err = fh.Stat()