replace strings.Index with strings.Contains instead

replace strings.Index() !=-1  with strings.Contains instead
This commit is contained in:
VillageHeadHuang 2023-07-14 15:25:36 +08:00 committed by GitHub
parent e3bc35bc1b
commit 037847066c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -711,7 +711,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
requestScope = "resource" requestScope = "resource"
operationSuffix = operationSuffix + "WithPath" operationSuffix = operationSuffix + "WithPath"
} }
if strings.Index(action.Path, "/{name}") != -1 || action.Verb == "POST" { if strings.Contains(action.Path, "/{name}") || action.Verb == "POST" {
requestScope = "resource" requestScope = "resource"
} }
if action.AllNamespaces { if action.AllNamespaces {