I can t detail the details, but just use interface{} package main
import ( "fmt" ) type MyStruct struct { a int b int } func myFunc(p interface{}) { fmt.Printf("Here is the type: %T\n", p) } func main() { var m *MyStruct myFunc(&m) myFunc(MyStruct{}) } On Monday, November 7, 2016 at 6:16:55 PM UTC+1, Kaylen Wheeler wrote: > > I'm new to Go, and I'm still trying to figure it out. I'm trying to write > a function that takes a pointer to a pointer of any type. > > I tried writing it like this: > > type MyStruct struct { > a int > b int > } > > func myFunc(p **interface{}) { > fmt.Printf("Here is the type: %T\n", p) > } > > func main() { > var m *MyStruct > myFunc(&m) > } > > However, I get the error: > > .\main.go:32: cannot use &m (type **MyStruct) as type **interface {} in > argument to myFunc > > Elapsed: 1.001s > > Result: Error > > Is there any way to do this? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.