Merge pull request #122600 from lzhecheng/credentialprovider-plugin-use-error-is

Use errors.Is() to handle err returned by LookPath()
This commit is contained in:
Kubernetes Prow Robot 2024-01-05 20:22:48 +01:00 committed by GitHub
commit d4678c79e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,7 @@ func RegisterCredentialProviderPlugins(pluginConfigFile, pluginBinDir string) er
// LookPath() also calls os.Stat().
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
if err != nil {
if os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist) || errors.Is(err, exec.ErrNotFound) {
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
}