Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
golang http/template 有替代特性,if构造,但是没找到for构造。如何遍历切片?像这样:
if
for
{{for x in xs}} Hello, {{x.Name}}! {{end}}
采用range
range
{{range xs}} Hello, {{.Name}}! {{end}}