-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdba890
commit 6e19d64
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func main() { | ||
for _, filePath := range os.Args[1:] { | ||
checkFileForTypos(filePath) | ||
} | ||
} | ||
|
||
func checkFileForTypos(filePath string) { | ||
file, err := os.Open(filePath) | ||
if err != nil { | ||
fmt.Printf("Failed to open file %s: %v\n", filePath, err) | ||
return | ||
} | ||
defer file.Close() | ||
|
||
scanner := bufio.NewScanner(file) | ||
lineNumber := 1 | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
// TODO: Use a spell-checking library to check the line for typos. | ||
// If a typo is found, print a message with the line number and the typo. | ||
fmt.Printf("Checking line %d for typos...\n", lineNumber) | ||
lineNumber++ | ||
} | ||
|
||
if err := scanner.Err(); err != nil { | ||
fmt.Printf("Failed to read file %s: %v\n", filePath, err) | ||
} | ||
} | ||
|