[Go 编程语言] 初学 golang,小白求解惑!

package main import "fmt" type Test struct { Id int64 Name string
} func main() { var list = []Test{ Test{Id: 1, Name: "1XX"}, Test{Id: 2, Name: "2XX"}, Test{Id: 3, Name: "3XX"}, } for _, v := range list { v.Name = "888" } fmt.Println(list)
}

为啥修改 Name 貌似没生效

发表评论