summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
index da642fa73..4c67ed598 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
@@ -66,7 +66,7 @@ func (gr GroupResource) Empty() bool {
return len(gr.Group) == 0 && len(gr.Resource) == 0
}
-func (gr *GroupResource) String() string {
+func (gr GroupResource) String() string {
if len(gr.Group) == 0 {
return gr.Resource
}
@@ -85,11 +85,10 @@ func ParseGroupKind(gk string) GroupKind {
// ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed
// for each field.
func ParseGroupResource(gr string) GroupResource {
- if i := strings.Index(gr, "."); i == -1 {
- return GroupResource{Resource: gr}
- } else {
+ if i := strings.Index(gr, "."); i >= 0 {
return GroupResource{Group: gr[i+1:], Resource: gr[:i]}
}
+ return GroupResource{Resource: gr}
}
// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
@@ -112,7 +111,7 @@ func (gvr GroupVersionResource) GroupVersion() GroupVersion {
return GroupVersion{Group: gvr.Group, Version: gvr.Version}
}
-func (gvr *GroupVersionResource) String() string {
+func (gvr GroupVersionResource) String() string {
return strings.Join([]string{gvr.Group, "/", gvr.Version, ", Resource=", gvr.Resource}, "")
}
@@ -131,7 +130,7 @@ func (gk GroupKind) WithVersion(version string) GroupVersionKind {
return GroupVersionKind{Group: gk.Group, Version: version, Kind: gk.Kind}
}
-func (gk *GroupKind) String() string {
+func (gk GroupKind) String() string {
if len(gk.Group) == 0 {
return gk.Kind
}
@@ -282,8 +281,8 @@ func bestMatch(kinds []GroupVersionKind, targets []GroupVersionKind) GroupVersio
// ToAPIVersionAndKind is a convenience method for satisfying runtime.Object on types that
// do not use TypeMeta.
-func (gvk *GroupVersionKind) ToAPIVersionAndKind() (string, string) {
- if gvk == nil {
+func (gvk GroupVersionKind) ToAPIVersionAndKind() (string, string) {
+ if gvk.Empty() {
return "", ""
}
return gvk.GroupVersion().String(), gvk.Kind