```
a := []int{1,2,3}
x, a := a[len(a)-1], a[:len(a)-1]
fmt.Println(a,x)

```

How to create a `pop()` function that will do the same for any type of an array?

Here is what I came up with so far:

```
func pop(a []*interface{}) interface{}{
    x := a[len(a)-1]
    a = a[:len(a)-1]
    return x
}

func main(){
    a := []int{1,2,3}
    x = pop(a)
    fmt.Println(a,x)  // ->  [1,2] 3
}

```

But I get `cannot use a (type []int) as type []interface {}`or other error messages if I try to tweak the code by trial and error.