خرید بک لینک

Vote count: 0

I am wanting to populate a struct without passing it down as a param in a function. I have been doing it with using a parameter but it is becoming redundant that way. The way I want to achieve is:

type Foo struct {
    Name string
    Description string
    FinalDescription string
}

var bar = Thing("blah", func() {
    DescriptionOfThing("blah", func() {
        FinalDescriptionOfThink("blahblahblah")
    })
})

I am trying to obtain the following struct from the above:

bar{
    Name: "blah",
    Description: "blah",
    FinalDescription: "blahblahblah",
} 

Any help would be great!

asked 51 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 20 خرداد 1395 ساعت: 10:12

صفحه بندی