As far as I remember(maybe I have missing something),
var v = Value{
Name:"xxx",
}
Is the old way to initial an embeded field.
Some issuse changes the way of this.
I can't find the original discussion.
在2021年6月7日星期一 UTC+8 下午5:28:27<[email protected]> 写道:
> I don't understand the question. This has always been how the language
> worked, all the way back to Go 1.0 at least. As far as I'm aware.
>
> Embedding only effects selector expressions and methods sets - i.e. it
> allows you to write `v.Name` instead of writing `v.Base.Name`. It doesn't
> affect composite literals.
>
> On Mon, Jun 7, 2021 at 11:20 AM Ally Dale <[email protected]> wrote:
>
>> Does anyone konw which proposal changes the access for embeded field name
>> of struct?
>> Eg:
>> ```
>> type Base struct{
>> Name string
>> }
>> type Value struct{
>> Base
>> }
>> ```
>>
>> We initial a Value as:
>> var v = Value{
>> Base: Base{
>> Name:"xxx",
>> }
>> }
>> instead of
>> var v = Value{
>> Name:"xxx",
>> }
>>
>> I want to know why golang change the access method.
>> Anyone who knows the isssue link, please reply me. Thanks a lot.
>>
>> --
>> 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].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/ff4f3443-c863-4d96-958c-76023979b0ben%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/golang-nuts/ff4f3443-c863-4d96-958c-76023979b0ben%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/7d00093f-0253-489e-a5c9-40eceb5b2f1bn%40googlegroups.com.