Assuming:

type Prop struct {
    Type  string
    Price float64
}

This ...

var props []Prop
props = append(props, Prop{"test", 4000})
props = append(props, Prop{"foo", 2313})
props = append(props, Prop{"bar", 2313})

same as:

props := []Prop{{"test", 4000}, {"foo", 2313}, {"bar", 2313}}

same as:

var props = []Prop{{"test", 4000}, {"foo", 2313}, {"bar", 2313}}
Feedback

Powered by Vanilla PHP feedback form