type Point struct {
X int
Y int
}
func main() {
s := make([]Point, 4)
for i, v := range s {
v.X = i
v.Y = i
}
fmt.Println(s)
}
--------------
[{0 0} {0 0} {0 0} {0 0}]
view raw range.go hosted with ❤ by GitHub