1
1
mirror of https://github.com/wader/fq.git synced 2024-11-29 12:14:17 +03:00
fq/internal/ioextra/ioextra.go
2021-09-20 17:47:40 +02:00

29 lines
478 B
Go

package ioextra
import (
"errors"
"io"
)
func SeekerEnd(s io.Seeker) (int64, error) {
cPos, err := s.Seek(0, io.SeekCurrent)
if err != nil {
return 0, err
}
epos, err := s.Seek(0, io.SeekEnd)
if err != nil {
return 0, err
}
if _, err := s.Seek(cPos, io.SeekStart); err != nil {
return 0, err
}
return epos, nil
}
type ReadErrSeeker struct{ io.Reader }
func (r *ReadErrSeeker) Seek(offset int64, whence int) (int64, error) {
return 0, errors.New("seek")
}