Initialize nested struct definition

Your Contact is a field with anonymous struct type. As such, you have to repeat the type definition:

s := &Sender{
    BankCode: "BC",
    Name:     "NAME",
    Contact: struct {
        Name  string
        Phone string
    }{
        Name:  "NAME",
        Phone: "PHONE",
    },
}

But in most cases it’s better to define a separate type as rob74 proposed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)