This question already has an answer here:
I am trying to pass string array to the function, print values, modify it and then as the function is finished print value of the string array.
Here is my sample code which does not work but present what i want to achive:
package main
import (
"fmt"
)
func SendData(a *[]string) {
fmt.Println(*a)
*a = *a[:0]
}
func main() {
var s []string
s = append(s, "dat","boi")
SendData(&s)
fmt.Println(s)
}
This is the error at compilation: cannot slice a (type *[]string)
</div>