This commit is contained in:
2026-02-28 00:28:26 +01:00
committed by Konstantin Hintermayer
parent d6357adeed
commit 1f38008509

View File

@@ -60,12 +60,7 @@ func main() {
continue
}
count, err := countWordsInFile(content)
if err != nil {
fmt.Printf("Error getting review for %s: %v\n", file.Filename, err)
continue
}
count := countWords(content)
counts = append(counts, fmt.Sprintf("#### Review for `%s`\n\n%s", file.Filename, count))
}
@@ -97,21 +92,6 @@ func readFile(path string) (string, error) {
return string(content), nil
}
func countWordsInFile(path string) (int, error) {
file, err := os.Open(path)
if err != nil {
return 0, err
}
defer file.Close()
content, err := io.ReadAll(file)
if err != nil {
return 0, err
}
return countWords(string(content)), nil
}
func countWords(text string) int {
return len(strings.Fields(text))
}