fmt.Println(\"Enter position to delete::\") fmt.Scanln(&pos) new_arr := make([]int, (len(arr) - 1)) k := 0 for i := 0; i < (len(arr) - 1); { if i != pos {
I take the below approach to remove the item in slice. This helps in readability for others. And also immutable.
func remove(items []string, item string) []string { newitems := []string{} for _, i := range items { if i != item { newitems = append(newitems, i) } } return newitems }