如何将结构片段传递给模板并在Golang中进行迭代?

I want to pass a slice that contains structs and display the all the values in the view.

type Person struct {
    ID   int
    NAME string
}

Example of a slice of structs

 [{1 John},{2, Mary},{3, Steven},{4, Mike}]

What I want in index.html

1 - John
2 - Mary
3 - Steven
4 - Mike

I found a relevant post and I solved it. Thank you guys.

Go templates : range over slice of structs instead of struct of slices

So as mkopriva mentioned, use range action.