From 2dbb7ace06815bde63fd7572ec62a7289c1dff0b Mon Sep 17 00:00:00 2001 From: gilfoyle97 Date: Thu, 10 Feb 2022 19:59:05 +0100 Subject: [PATCH] Update slice.go --- utils/slice.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/slice.go b/utils/slice.go index 67e8d38..8f1a71f 100644 --- a/utils/slice.go +++ b/utils/slice.go @@ -28,7 +28,8 @@ import ( "strings" ) -//RemoveDuplicateValues removes duplicates rom a string slice +//RemoveDuplicateValues removes duplicates from a slice +//of strings func RemoveDuplicateValues(strSlice []string) []string { keys := make(map[string]bool) list := []string{} @@ -43,6 +44,8 @@ func RemoveDuplicateValues(strSlice []string) []string { //CheckInputArray checks the basic rules to //be valid and then returns the array as input. +// - Delete duplicates +// - Avoid empty strings func CheckInputArray(input string) []string { delimiter := byte(',') sliceOut := strings.Split(input, string(delimiter)) @@ -57,9 +60,9 @@ func CheckInputArray(input string) []string { } //CheckCookies checks if the string provided to the -//-cookie option is a valid one. +//-cookie option is valid. //format: "name1:value1;name2:value2" -//It returns a slice of Cookies (empty if no one) +//It returns a slice of Cookies func CheckCookies(input string) []*http.Cookie { var result []*http.Cookie if input == "" {