fix: filter by filename instead of whole path (#42)
This commit is contained in:
parent
64c61dd178
commit
4dd501a2f8
1 changed files with 1 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ func ReplaceTextInFile(file string, text string, replacement string) error {
|
||||||
|
|
||||||
func ReplaceTextInDirRecursive(dir string, text string, replacement string, filter func(file string) bool) error {
|
func ReplaceTextInDirRecursive(dir string, text string, replacement string, filter func(file string) bool) error {
|
||||||
return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
||||||
if filter(path) {
|
if filter(filepath.Base(path)) {
|
||||||
_ = ReplaceTextInFile(path, text, replacement)
|
_ = ReplaceTextInFile(path, text, replacement)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue