go 切片数组去重

func RemoveDuplicateElement(stringList []string) []string {
result := make([]string, 0, len(stringList))
temp := map[string]struct{}{}
for _, item := range stringList {
if _, ok := temp[item]; !ok {
temp[item] = struct{}{}
result = append(result, item)
}
}
return result
}
原文地址:https://www.cnblogs.com/ithubb/p/14143095.html