You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text/template function index should permit integer values of float type as indexes, since there's no way to convert types in templates themselves.
I hit this particular problem when using unmarshaled JSON as the template data, similar to what's done in the play link below, where an integer in one part refers to an index of a list in another part, but when parsed, the integer is converted to float64.
Note that the function eq is also loose with types.
@bradfitz In my case, the JSON can be anything, hence why it unmarshals into interface{}. I suppose this might be an edge case, but it seems like we already went down this road with eq...
The text/template function
index
should permit integer values of float type as indexes, since there's no way to convert types in templates themselves.I hit this particular problem when using unmarshaled JSON as the template data, similar to what's done in the play link below, where an integer in one part refers to an index of a list in another part, but when parsed, the integer is converted to float64.
Note that the function
eq
is also loose with types.What did you do?
https://play.golang.org/p/_9K1wu6THk
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: