You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ossie.apache.org by jb...@apache.org on 2026/07/13 16:16:07 UTC

(ossie) 03/10: fix(cli): use errors.Is for ErrNotExist checks in discover

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch pr-6
in repository https://gitbox.apache.org/repos/asf/ossie.git

commit afa1813878cde7d8280467a83f35c647e577816f
Author: Quigley Malcolm <qu...@dbtlabs.com>
AuthorDate: Mon Jun 15 10:25:51 2026 -0500

    fix(cli): use errors.Is for ErrNotExist checks in discover
    
    os.IsNotExist does not handle wrapped errors correctly. Replace both
    occurrences with errors.Is(err, os.ErrNotExist), the modern idiom
    since Go 1.13.
---
 cli/internal/plugin/discover.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cli/internal/plugin/discover.go b/cli/internal/plugin/discover.go
index 700dec1..d49bf3d 100644
--- a/cli/internal/plugin/discover.go
+++ b/cli/internal/plugin/discover.go
@@ -1,6 +1,7 @@
 package plugin
 
 import (
+	"errors"
 	"fmt"
 	"io"
 	"os"
@@ -24,7 +25,7 @@ const pluginYAML = "plugin.yaml"
 func Discover(pluginsDir string, stderr io.Writer) ([]*Plugin, error) {
 	entries, err := os.ReadDir(pluginsDir)
 	if err != nil {
-		if os.IsNotExist(err) {
+		if errors.Is(err, os.ErrNotExist) {
 			return nil, nil
 		}
 		return nil, fmt.Errorf("could not read plugin directory %s: %w", pluginsDir, err)
@@ -53,7 +54,7 @@ func loadPlugin(dir string) (*Plugin, error) {
 	yamlPath := filepath.Join(dir, pluginYAML)
 	data, err := os.ReadFile(yamlPath)
 	if err != nil {
-		if os.IsNotExist(err) {
+		if errors.Is(err, os.ErrNotExist) {
 			return nil, fmt.Errorf("no plugin.yaml found")
 		}
 		return nil, fmt.Errorf("could not read plugin.yaml: %w", err)