GoogleCloudPlatform/kubernetes — pull request #2539 by lavalamp (2014-11-22 08:05:11+00:00)
Title: Reduce boilerplate

I've been becoming increasingly worried about the boilerplate in our conversion functions -- it's so easy for errors to hide in there. This change lets you specify struct field/name -> other struct field/name copying, so we don't have to repeat the same copy so many times.

In the future I might extend this to let you dig in multiple levels (e.g., in.Labels -> out.ObjectMeta.Labels), which should get rid of the rest of the boilerplate functions here. When I made these I was expecting to see mostly functions of the sort that fixes up the EnvVar type, where a tiny bit of actual logic is needed, and I've been dismayed at the proliferation of boilerplate...

(Speaking of errors, did pod's label location really not change to be inside object meta?)