Correction: https://play.golang.org/p/T4Lq07xDgl
func main() {
x := Thing.Embedded{Name: "Barry"}
fmt.Println(x.Name)
// output:
// Barry
}
This is what happens when I can't rely on the compiler...
On Wednesday, 24 August 2016 23:07:59 UTC+1, Sam Salisbury wrote:
>
> Would it be nice or nasty for this to work?
> https://play.golang.org/p/iCTKx3gF_2
>
> Copy-pasted:
>
> type Thing struct {
> Embedded struct {
> Name string
> }
> }
>
> func main() {
> x := Thing.Embedded{Name: "Barry"}
> fmt.Println(x.Thing.Name)
> // output:
> // Barry
> }
>
>
> Seems it would be useful to me to be able to do this sometimes, especially
> when consuming other people's code that uses embedded struct types.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.