Answer the question
In order to leave comments, you need to log in
How to create a pointer to a list of pointers by interface?
So I create a list of pointers by interface.
package main
import (
"fmt"
"reflect"
)
type Example struct {
Name string
}
func main() {
p := new(Example)
r := reflect.TypeOf(p)
t := reflect.SliceOf(r)
s := reflect.New(t).Elem().Interface()
x := new([]*Example)
fmt.Printf("%#v = %#v\n", x, s)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question