Skip to content

Commit

Permalink
tools/spellcheck: Remove project root from spellcheck output
Browse files Browse the repository at this point in the history
The spellcheck will output its best guess for the location of misspelled
words in the markdown files. This is useful for the user to quickly find
and fix the misspelled words. However, the output also includes the
project root, which is likely different for every system including the
host vs in a docker container. By removing the project root from the
output, we get a relative path which most terminals can use to open the
file as long as the working directory is the project root.

Signed-off-by: Dylan Reimerink <[email protected]>
  • Loading branch information
dylandreimerink committed Oct 15, 2024
1 parent c85d8a7 commit 86291c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/spellcheck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ func checkFile(path string) error {
fmt.Printf("Possible locations in markdown:\n")

for _, loc := range possibleLocations {
fmt.Printf(" %s:%d:%d\n", loc.file, loc.line, loc.column+m.offset)
noRoot := strings.TrimPrefix(strings.TrimPrefix(loc.file, *projectroot), "/")
fmt.Printf(" %s:%d:%d\n", noRoot, loc.line, loc.column+m.offset)
}
}
fmt.Println()
Expand Down

0 comments on commit 86291c3

Please sign in to comment.