package main import ( "fmt" ) func main() { ds := []map[string]interface{}{} item := map[string]interface{}{} for i := 0; i < 5; i++ { item["cc"] = i fmt.Println(ds, item) ds = append(ds, item) fmt.Println(ds) } }
package main import ( "fmt" ) func main() { ds := []map[string]interface{}{} for i := 0; i < 5; i++ { item := map[string]interface{}{} item["cc"] = i fmt.Println(ds, item) ds = append(ds, item) fmt.Println(ds) } }
有疑问加站长微信联系(非本文作者)