func (o *ResourceMap) Add(resource *Resource) {
	list, ok := (*o)[resource.Kind]
	if ok {
		for _, otherResource := range list {
			if resource.Replaces(otherResource) {
				otherResource.ReplacedBy = &resource.Key
			} else if otherResource.Replaces(resource) {
				resource.ReplacedBy = &otherResource.Key
			}
		}
		list = append(list, resource)
	} else {
		list = []*Resource{resource}
	}
	sort.Sort(list)
	(*o)[resource.Kind] = list
}
Add a resource to the resource list
package kubernetes
import (
	"fmt"
	"sort"
	"github.com/go-openapi/spec"
)
type Resource struct {
	Key Key
	GVKExtension
	Definition spec.Schema
	ReplacedBy *Key
	Documented bool
}
func (o *Resource) LessThan(p *Resource) bool {
	return o.Group.Replaces(p.Group) || (o.Group == p.Group && p.Version.LessThan(&o.Version))
}
func (o *Resource) Replaces(p *Resource) bool {
	return o.Group.Replaces(p.Group) || o.Version.Replaces(&p.Version)
}
func (o *Resource) Equals(group APIGroup, version APIVersion, kind APIKind) bool {
	return o.Group == group && o.Version.Equals(&version) && o.Kind == kind
}
func (o *Resource) GetGV() string {
	if o.Group == "" {
		return o.Version.String()
	}
	return fmt.Sprintf("%s/%s", o.Group, o.Version.String())
}
type ResourceList []*Resource
func (a ResourceList) Len() int           { return len(a) }
func (a ResourceList) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ResourceList) Less(i, j int) bool { return a[i].LessThan(a[j]) }
type ResourceMap map[APIKind]ResourceList