package main
import (
"fmt"
)
type bar struct {
}
func (b bar) String() string {
return "bar"
}
type foo struct {
b []*bar
bb *bar
}
func main() {
f := foo{b: []*bar{&bar{}}, bb:&bar{}}
fmt.Println(f, f.b, f.bb)
}
Why is the result
{[0x176f44] 0x176f44} [bar] bar
and not
{[bar] bar} [bar] bar
Are there any reasons behind it? It seems easy to implement and good for readability.