From 9e49d37b4f5a20e77fe1142ee0920cd7ef49c939 Mon Sep 17 00:00:00 2001 From: Matthias Diester Date: Sat, 4 Jan 2025 15:03:08 +0100 Subject: [PATCH] Change error check Ref: https://github.com/shipwright-io/build/pull/1765 Change the way to check for the error so that it finds the error in an error chain. Signed-off-by: Matthias Diester --- pkg/git/git.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/git/git.go b/pkg/git/git.go index 28942ebd2e..9d20a6affe 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -6,6 +6,7 @@ package git import ( "context" + "errors" "fmt" "github.com/go-git/go-git/v5/config" @@ -45,7 +46,7 @@ func ValidateGitURLExists(ctx context.Context, urlPath string) error { // path doesn't exist, func will return `authentication required`, // this is maybe misleading. So convert this error message to: // `remote repository unreachable` - if err == transport.ErrAuthenticationRequired { + if errors.Is(err, transport.ErrAuthenticationRequired) { return fmt.Errorf("remote repository unreachable") }