a73x

3863cb13

refactor(scanner): use builtin min() for sniff size

a73x   2026-04-29 05:46

Commit message
refactor(scanner): use builtin min() for sniff size

internal/scanner/scanner.go
Old New
@@ -70,10 +70,7 @@ func Scan(path string) ([]Marker, error) {
70 } 70 }
71 71
72 // Binary sniff: read first 8 KB, look for null byte. 72 // Binary sniff: read first 8 KB, look for null byte.
73 sniffN := int64(8192) 73 sniffN := min(int64(8192), st.Size())
74 if st.Size() < sniffN {
75 sniffN = st.Size()
76 }
77 sniff := make([]byte, sniffN) 74 sniff := make([]byte, sniffN)
78 sf, err := os.Open(path) 75 sf, err := os.Open(path)
79 if err != nil { 76 if err != nil {