Initial split of internal and external api types.

http://play.golang.org/p/DiUlxeszS1



On Tue, Jul 15, 2014 at 9:55 PM, Daniel Smith <notifications@github.com>
wrote:

> In pkg/api/internal/helper.go:
>
> > +	obj = checkPtr(obj)
> > +	jsonBase, err := prepareEncode(obj)
> > +	if err != nil {
> > +		return nil, err
> > +	}
> > +	data, err = json.MarshalIndent(obj, "", "	")
> > +	jsonBase.Kind = ""
> > +	return data, err
> > +}
> > +
> > +func checkPtr(obj interface{}) interface{} {
> > +	v := reflect.ValueOf(obj)
> > +	if v.Kind() == reflect.Ptr {
> > +		return obj
> > +	}
> > +	v2 := reflect.New(v.Type())
>
> It's not exactly analogous. See:
> http://golang.org/pkg/reflect/#Value.CanAddr
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/476/files#r14981276>
> .
>