IntOrString for use in JSON/YAML

Specifying an API type as IntOrString will allow JSON and YAML to accept
either ints or strings with the same name.  For example, port names or
numbers.
To be honest the YAML docs around this *suck*.  I trawled the code and saw
internal examples using "", so I tried it.  Empirically it works.


On Thu, Jul 10, 2014 at 11:52 AM, Johan Euphrosine <notifications@github.com
> wrote:

> In pkg/util/util.go:
>
> > +		intstr.StrVal = strVal
> > +		return true
> > +	}
> > +	return false
> > +}
> > +
> > +func (intstr IntOrString) GetYAML() (tag string, value interface{}) {
> > +	switch intstr.Kind {
> > +	case IntstrInt:
> > +		value = intstr.IntVal
> > +	case IntstrString:
> > +		value = intstr.StrVal
> > +	default:
> > +		panic("impossible IntOrString.Kind")
> > +	}
> > +	return
>
> is tag always empty?
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/395/files#r14785218>
> .
>