gitlab.com/evatix-go/core@v1.3.55/coreunique/intunique/Get.go (about) 1 package intunique 2 3 func Get(intSlice *[]int) *[]int { 4 if intSlice == nil { 5 return intSlice 6 } 7 8 length := len(*intSlice) 9 10 if length == 0 || length == 1 { 11 return intSlice 12 } 13 14 dict := make(map[int]bool, length) 15 16 for _, v := range *intSlice { 17 dict[v] = true 18 } 19 20 newSlice := make([]int, 0, len(dict)) 21 22 for k := range dict { 23 newSlice = append(newSlice, k) 24 } 25 26 return &newSlice 27 }