exp/template: support field syntax on maps
While using exp/template in practice, the syntax for indexing values using the "index" action was found to be very inconvenient for frequent use when handling dynamic data from maps such as the ones used with json and yaml, that use a type like map[string]interface{}. For these kinds of maps, the default handling of fields as {{.Field}} makes the task of handling the several references significantly more pleasant and elegant, and is equivalent to what's currently done in the "template" package and in other external packages (e.g. mustache). Even with this change, the index action is still relevant as it allows indexing maps in other scenarios where keys wouldn't be valid field names. R=golang-dev, r, gustavo CC=golang-dev https://golang.org/cl/4898043
Showing
Please
register
or
sign in
to comment