🀄 完善标签查询功能

This commit is contained in:
dushixiang committed 2021-01-06 20:47:52 +08:00
1 parent fbac4c7c2b
commit 1a3a4025d5
4 files changed
+82 -10

No files matched your search

+13
View File
@@ -119,3 +119,16 @@ func IsDir(path string) bool {
func IsFile(path string) bool {
return !IsDir(path)
}
// 去除重复元素
func Distinct(list []string) []string {
result := make([]string, 0, len(list))
temp := map[string]struct{}{}
for _, item := range list {
if _, ok := temp[item]; !ok {
temp[item] = struct{}{}
result = append(result, item)
}
}
return result
}