<commit_before>/*
Copyright 2014 <NAME>
MIT Licence.  See /LICENSE.txt
*/
package main

import (
	"fmt"
	"log"
	"os"
	"path/filepath"
)

func visit(path string, f os.FileInfo, err error) error {
	if err != nil {
		log.Println("Error calling: ", path, err)
	}
	if f.IsDir() {
		return os.MkdirAll(fmt.Sprintf("%s%s", getSnapshotDir(), path), 0766)
	}
	if f.Mode().IsRegular() {
		pathfile := savefile{path}
		errr := pathfile.hashPathAndLink()
		if errr != nil {
			log.Println("ERROR", path, errr)
		}
	}
	return nil
}

func handleDir(source string) {
	_ = filepath.Walk(source, visit)
}
<commit_msg>Crashes if a file is deleted during a run<commit_after>/*
Copyright 2014 <NAME>
MIT Licence.  See /LICENSE.txt
*/
package main

import (
	"fmt"
	"log"
	"os"
	"path/filepath"
)

func visit(path string, f os.FileInfo, err error) error {
	if err != nil {
		log.Println("Error calling: ", path, err)
	}
	if f == nil {
		log.Println("No file: ", path)
		return nil
	}
	if f.IsDir() {
		return os.MkdirAll(fmt.Sprintf("%s%s", getSnapshotDir(), path), 0766)
	}
	if f.Mode().IsRegular() {
		pathfile := savefile{path}
		errr := pathfile.hashPathAndLink()
		if errr != nil {
			log.Println("ERROR", path, errr)
		}
	}
	return nil
}

func handleDir(source string) {
	_ = filepath.Walk(source, visit)
}

{'fraction_non_alphanumeric': 0.16176470588235295, 'fraction_numerical': 0.01238390092879257, 'mean_word_length': 3.6510791366906474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2908091', 'n_tokens_mistral': 546, 'n_tokens_neox': 511, 'n_words': 128}