vet: optimize performance for path detection, when vetting files (#21139)

This commit is contained in:
Turiiya 2024-03-29 18:28:18 +01:00 committed by GitHub
parent 030a85c2d0
commit a015824eef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,14 +64,11 @@ fn main() {
} }
if os.is_dir(path) { if os.is_dir(path) {
vt.vprintln("vetting folder: '${path}' ...") vt.vprintln("vetting folder: '${path}' ...")
vfiles := os.walk_ext(path, '.v') os.walk(path, fn [mut vt] (p string) {
vvfiles := os.walk_ext(path, '.vv') if p.ends_with('.v') || p.ends_with('.vv') {
mut files := []string{} vt.vet_file(p)
files << vfiles }
files << vvfiles })
for file in files {
vt.vet_file(file)
}
} }
} }
vfmt_err_count := vt.errors.filter(it.fix == .vfmt).len vfmt_err_count := vt.errors.filter(it.fix == .vfmt).len