-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Description
- What version of Go are you using (
go version)?
1.6 - What operating system and processor architecture are you using (
go env)?
linux/amd64 - What did you do?
http://play.golang.org/p/5EinJM-QLi
Consider a template wheredotis set to a slice of (non-pointer) values.
If I{{range}}ondot, I can call pointer-receiver methods on each element. However, if I{{index}}ondot, then pointer-receiver methods cause the template execution to fail with a "PointerReceiver is not a field of struct type main.someStruct" error. - What did you expect to see?
Pointer-receiver method works on{{index}}ed elements just as it does on{{range}}d ones.
It has been suggested to me that might be "a bug in the template package: for method calls on slice elements, it should probably be usingv.Index(i).Addr().Call([...])rather thanv.Index(i).Call([...])" - What did you see instead?
See error above.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.