Skip to content

Commit 8be6392

Browse files
cuishuangneild
authored andcommitted
webdav: replace os.SEEK_XXX with io.SeekXXX
Change-Id: I304410ad143377d48bd6eafcbf2413dcfc4e70a2 GitHub-Last-Rev: 0136a8a GitHub-Pull-Request: #151 Reviewed-on: https://go-review.googlesource.com/c/net/+/432257 Run-TryBot: Damien Neil <[email protected]> Reviewed-by: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent d300de1 commit 8be6392

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

webdav/file.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,11 @@ func (f *memFile) Seek(offset int64, whence int) (int64, error) {
547547
npos := f.pos
548548
// TODO: How to handle offsets greater than the size of system int?
549549
switch whence {
550-
case os.SEEK_SET:
550+
case io.SeekStart:
551551
npos = int(offset)
552-
case os.SEEK_CUR:
552+
case io.SeekCurrent:
553553
npos += int(offset)
554-
case os.SEEK_END:
554+
case io.SeekEnd:
555555
npos = len(f.n.data) + int(offset)
556556
default:
557557
npos = -1

webdav/file_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -711,11 +711,11 @@ func TestMemFile(t *testing.T) {
711711
default:
712712
t.Fatalf("test case #%d %q: invalid seek whence", i, tc)
713713
case "set":
714-
whence = os.SEEK_SET
714+
whence = io.SeekStart
715715
case "cur":
716-
whence = os.SEEK_CUR
716+
whence = io.SeekCurrent
717717
case "end":
718-
whence = os.SEEK_END
718+
whence = io.SeekEnd
719719
}
720720
offset, err := strconv.Atoi(parts[1])
721721
if err != nil {

webdav/prop.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ func findContentType(ctx context.Context, fs FileSystem, ls LockSystem, name str
425425
}
426426
ctype = http.DetectContentType(buf[:n])
427427
// Rewind file.
428-
_, err = f.Seek(0, os.SEEK_SET)
428+
_, err = f.Seek(0, io.SeekStart)
429429
return ctype, err
430430
}
431431

0 commit comments

Comments
 (0)