|
@@ -8,6 +8,7 @@ import (
|
|
"log"
|
|
"log"
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
|
|
+ "slices"
|
|
"sort"
|
|
"sort"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
@@ -257,8 +258,7 @@ func compareFolder(folder string) {
|
|
values = make([]string, 0)
|
|
values = make([]string, 0)
|
|
}
|
|
}
|
|
filepath := fmt.Sprintf("%s/%s", hashFile.Path, filename)
|
|
filepath := fmt.Sprintf("%s/%s", hashFile.Path, filename)
|
|
- pos := sort.SearchStrings(ignoreLines, filepath)
|
|
|
|
- if pos == len(ignoreLines) {
|
|
|
|
|
|
+ if !contains(filepath) {
|
|
_, err := os.Stat(filepath)
|
|
_, err := os.Stat(filepath)
|
|
if err == nil {
|
|
if err == nil {
|
|
values = append(values, filepath)
|
|
values = append(values, filepath)
|
|
@@ -320,7 +320,7 @@ func compareFolder(folder string) {
|
|
fmt.Println(err)
|
|
fmt.Println(err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- err = ioutil.WriteFile(report, b, 0644)
|
|
|
|
|
|
+ err = os.WriteFile(report, b, 0644)
|
|
if err != nil {
|
|
if err != nil {
|
|
panic(err)
|
|
panic(err)
|
|
}
|
|
}
|
|
@@ -356,11 +356,24 @@ func compareFolder(folder string) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func contains(filepath string) bool {
|
|
|
|
+ return slices.Contains(ignoreLines, strings.ToLower(filepath))
|
|
|
|
+}
|
|
|
|
+
|
|
func loadIgnoreFile(filename string) {
|
|
func loadIgnoreFile(filename string) {
|
|
- content, err := ioutil.ReadFile(filename)
|
|
|
|
|
|
+ content, err := os.ReadFile(filename)
|
|
if err == nil {
|
|
if err == nil {
|
|
- ignoreLines = strings.Split(string(content), "\n")
|
|
|
|
- sort.Strings(ignoreLines)
|
|
|
|
|
|
+ lines := strings.Split(string(content), "\n")
|
|
|
|
+ ignoreLines = make([]string, 0)
|
|
|
|
+ for _, line := range lines {
|
|
|
|
+ line = strings.TrimSpace(line)
|
|
|
|
+ line = strings.ToLower(line)
|
|
|
|
+ line, _ = strings.CutSuffix(line, "\r")
|
|
|
|
+ if line != "" {
|
|
|
|
+ ignoreLines = append(ignoreLines, line)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ slices.Sort(ignoreLines)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|