mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Use errors.Is() to handle err returned by LookPath()
Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
This commit is contained in:
parent
09a5049ca7
commit
af6e653f17
@ -102,7 +102,7 @@ func RegisterCredentialProviderPlugins(pluginConfigFile, pluginBinDir string) er
|
|||||||
// LookPath() also calls os.Stat().
|
// LookPath() also calls os.Stat().
|
||||||
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
|
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
|
||||||
if err != nil {
|
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)
|
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user