apimachinery: cleanup if...else statement

if block ends with a return statement, so drop this else and outdent its block
This commit is contained in:
Cong Ding 2018-07-02 17:29:56 -07:00
parent 3cd867fa6b
commit 10698f8774

View File

@ -85,11 +85,10 @@ func ParseGroupKind(gk string) GroupKind {
// ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed // ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed
// for each field. // for each field.
func ParseGroupResource(gr string) GroupResource { func ParseGroupResource(gr string) GroupResource {
if i := strings.Index(gr, "."); i == -1 { if i := strings.Index(gr, "."); i >= 0 {
return GroupResource{Resource: gr}
} else {
return GroupResource{Group: gr[i+1:], Resource: gr[:i]} return GroupResource{Group: gr[i+1:], Resource: gr[:i]}
} }
return GroupResource{Resource: gr}
} }
// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion // GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion