add comments, code refactor, fix typo

This commit is contained in:
MaysWind
2020-12-23 00:09:35 +08:00
parent bb10498893
commit 17d1cd8719
10 changed files with 49 additions and 13 deletions
+2
View File
@@ -1,5 +1,6 @@
package utils
// Int64SliceMinus returns a int64 array which contains items in s1 but not in s2
func Int64SliceMinus(s1, s2 []int64) []int64 {
if s1 == nil {
return nil
@@ -21,6 +22,7 @@ func Int64SliceMinus(s1, s2 []int64) []int64 {
return ret
}
// ToUniqueInt64Slice returns a int64 array which does not have duplicated items
func ToUniqueInt64Slice(items []int64) []int64 {
uniqueItems := make([]int64, 0, len(items))
itemExistMap := make(map[int64]bool)