From 037847066ce7ebb622c4b207355ac97814414841 Mon Sep 17 00:00:00 2001 From: VillageHeadHuang <774262573@qq.com> Date: Fri, 14 Jul 2023 15:25:36 +0800 Subject: [PATCH] replace strings.Index with strings.Contains instead replace strings.Index() !=-1 with strings.Contains instead --- staging/src/k8s.io/apiserver/pkg/endpoints/installer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go index f1adddba54a..4fbdf8920c4 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go @@ -711,7 +711,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag requestScope = "resource" operationSuffix = operationSuffix + "WithPath" } - if strings.Index(action.Path, "/{name}") != -1 || action.Verb == "POST" { + if strings.Contains(action.Path, "/{name}") || action.Verb == "POST" { requestScope = "resource" } if action.AllNamespaces {