func sortObjectsByKindAndName()

in gke-deploy/core/resource/resource.go [435:457]


func sortObjectsByKindAndName(objs []*Object) []*Object {
	sort.SliceStable(objs, func(i, j int) bool {
		a := objs[i]
		b := objs[j]

		aKind := ObjectKind(a)
		bKind := ObjectKind(b)
		aName, err := ObjectName(a)
		if err != nil {
			return false // Move a to end of slice
		}
		bName, err := ObjectName(b)
		if err != nil {
			return true // Move b to end of slice
		}

		if aKind == bKind {
			return aName < bName
		}
		return aKind < bKind
	})
	return objs
}