mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
fix(access_log): file size calculation
This commit is contained in:
@@ -26,12 +26,8 @@ type BackScanner struct {
|
||||
|
||||
// NewBackScanner creates a new Scanner to read the file backward.
|
||||
// chunkSize determines the size of each read chunk from the end of the file.
|
||||
func NewBackScanner(file ReaderAtSeeker, chunkSize int) *BackScanner {
|
||||
size, err := file.Seek(0, io.SeekEnd)
|
||||
if err != nil {
|
||||
return &BackScanner{err: err}
|
||||
}
|
||||
return newBackScanner(file, size, make([]byte, chunkSize))
|
||||
func NewBackScanner(file ReaderAtSeeker, fileSize int64, chunkSize int) *BackScanner {
|
||||
return newBackScanner(file, fileSize, make([]byte, chunkSize))
|
||||
}
|
||||
|
||||
func newBackScanner(file ReaderAtSeeker, fileSize int64, buf []byte) *BackScanner {
|
||||
@@ -111,11 +107,6 @@ func (s *BackScanner) Bytes() []byte {
|
||||
return s.line
|
||||
}
|
||||
|
||||
// FileSize returns the size of the file.
|
||||
func (s *BackScanner) FileSize() int64 {
|
||||
return s.size
|
||||
}
|
||||
|
||||
// Err returns the first non-EOF error encountered by the scanner.
|
||||
func (s *BackScanner) Err() error {
|
||||
return s.err
|
||||
|
||||
Reference in New Issue
Block a user