From 445044db9ce79097f43ab809ae80e11af43a219c Mon Sep 17 00:00:00 2001 From: Dor Kleiman Date: Fri, 1 May 2020 02:39:38 +0300 Subject: [PATCH] Simplify GroupVersion.Seting() The old code had special cases that returned the same values as the regular case does. If group is empty, the conditional ```if len(gv.Group) > 0 {``` doesn't apply, and `gv.Version` is returned. In the empty case, the special case was returning `""`, which is exactly what `gv.Version` contains. In the legacy v1 case, the special case was returning `"v1"`, which is exactly what `gv.Version` contains. --- .../apimachinery/pkg/runtime/schema/group_version.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go index 636103312f0..9563b88b720 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go @@ -176,15 +176,6 @@ func (gv GroupVersion) Empty() bool { // String puts "group" and "version" into a single "group/version" string. For the legacy v1 // it returns "v1". func (gv GroupVersion) String() string { - // special case the internal apiVersion for the legacy kube types - if gv.Empty() { - return "" - } - - // special case of "v1" for backward compatibility - if len(gv.Group) == 0 && gv.Version == "v1" { - return gv.Version - } if len(gv.Group) > 0 { return gv.Group + "/" + gv.Version }