Spread operator analogue
问题 I have a struct and the instance of that struct: type Obj struct { ssid string code string mit string // and other props (23) } var ValidObject = Obj { ssid: "AK93-KADJ9-92J76", code: "SKO-120O" mit: "MSLA-923-OKSW" } I want to create a slice of structs ( Obj ) which will contain ValidObject with only some fields changed. I think the best way to explain that would be using pseudo code, so here it is (using spread operator from JS :) ): var slc = []Obj{ { ...ValidObject, code: "Other value", }