I am using some code I found online to remove an element from a list:
func Remove(slice []string, s int) []string {
return append(slice[:s], slice[s+1:]...)
}
but the problem is whenever I use it it duplicates the last item on the list! The following code:
func main() {
lst := []string{"1", "2", "3"}
fmt.Println(lst)
slice.Remove(lst, 1)
fmt.Println(lst)
}
returns [1, 3, 3].
What am I doing wrong?