On Wednesday, February 15, 2017 at 11:25:16 AM UTC+2, dja...@gmail.com wrote: > > > > On Wednesday, February 15, 2017 at 10:40:35 AM UTC+2, Felix Sun wrote: >> >> https://play.golang.org/p/qYA8Ddnnye >> >> ``` >> >> package main >> >> import ( >> "fmt" >> ) >> >> type Obj struct { >> One *Obj >> } >> >> func main() { >> var o = &Obj{} >> >> var arr = []interface{}{o.One} >> >> fmt.Println(arr[0]) >> fmt.Println("why this is not true?", arr[0] == nil) >> } >> >> >> ``` >> >> >> Why `arr[0] == nil` is not true? >> >> Hi, there are misleading answers, so: > > First Println prints value of arr[0].One, winch is nil. > Second Println check if f arr[0] is nil (arr[0] is address of 'o') > > Ops, my bad, this is not true, > I must read source more carefully. > >
-- 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.