{"height":"190","provider_name":"Hatena Blog","version":"1.0","type":"rich","blog_url":"https://increment.hatenablog.com/","provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/tkyjhr/","width":"100%","title":"golang : template \u306e range \u3067 index \u3092\u4f7f\u3046","categories":["golang"],"blog_title":"i++","author_name":"tkyjhr","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fincrement.hatenablog.com%2Fentry%2F2016%2F04%2F27%2F203810\" title=\"golang : template \u306e range \u3067 index \u3092\u4f7f\u3046 - i++\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"\u4ee5\u4e0b\u306e\u69d8\u306a\u30c7\u30fc\u30bf\u3092 template.Execute \u306e\u30c7\u30fc\u30bf\u306b\u6e21\u3057\u305f\u3068\u3059\u308b\u3068 type data struct { Values []string OtherValues []string } \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067 <ul> {{range $i, $v := .Values}} <li>{{index $.OtherValues $i}} \u306e\u3088\u3046\u306b\u3059\u308b\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\uff08 OtherValues[i]\u306e\u5024\uff09\u3002{{$v}} \u306f\u3082\u3061\u308d\u3093 Values[i]</li> {{end}} </ul> \u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3001Values \u306b\u30eb\u30fc\u30d7\u3092\u304b\u3051\u3066\u3044\u308b\u6700\u4e2d\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3063\u3066\u4ed6\u306e\u914d\u5217\u3084\u30b9\u30e9\u30a4\u30b9\u2026","url":"https://increment.hatenablog.com/entry/2016/04/27/203810","published":"2016-04-27 20:38:10","image_url":null}