ci: Improve Golang code quality with updated lint configuration file (#307)

* refactor: Optimize code logic and reduce nesting.

* ci: Improve Golang code quality with updated configuration file

* chore: Update GitHub actions setup-go to version 5 and optimize caching.
This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2024-01-28 23:08:30 +08:00
parent 2f22fa79f6
commit 7bd5a06875
6 changed files with 336 additions and 39 deletions
+14 -13
View File
@@ -132,19 +132,20 @@ func (c *Chromium) userItemPaths(profilePath string, items []item.Item) (map[str
func chromiumWalkFunc(items []item.Item, multiItemPaths map[string]map[item.Item]string) filepath.WalkFunc {
return func(path string, info fs.FileInfo, err error) error {
for _, v := range items {
if info.Name() == v.Filename() {
if strings.Contains(path, "System Profile") {
continue
}
profileFolder := fileutil.ParentBaseDir(path)
if strings.Contains(filepath.ToSlash(path), "/Network/Cookies") {
profileFolder = fileutil.BaseDir(strings.ReplaceAll(filepath.ToSlash(path), "/Network/Cookies", ""))
}
if _, exist := multiItemPaths[profileFolder]; exist {
multiItemPaths[profileFolder][v] = path
} else {
multiItemPaths[profileFolder] = map[item.Item]string{v: path}
}
if info.Name() != v.Filename() {
continue
}
if strings.Contains(path, "System Profile") {
continue
}
profileFolder := fileutil.ParentBaseDir(path)
if strings.Contains(filepath.ToSlash(path), "/Network/Cookies") {
profileFolder = fileutil.BaseDir(strings.ReplaceAll(filepath.ToSlash(path), "/Network/Cookies", ""))
}
if _, exist := multiItemPaths[profileFolder]; exist {
multiItemPaths[profileFolder][v] = path
} else {
multiItemPaths[profileFolder] = map[item.Item]string{v: path}
}
}
return err