From 738b246fe97dfc555bb9a082434d85dee4011503 Mon Sep 17 00:00:00 2001 From: Azeem Shaikh Date: Tue, 1 Mar 2022 12:17:24 -0800 Subject: [PATCH] Fix cmd panic (#1692) Co-authored-by: Azeem Shaikh --- checker/client.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/checker/client.go b/checker/client.go index 986b817232d..6d643a49863 100644 --- a/checker/client.go +++ b/checker/client.go @@ -36,12 +36,16 @@ func GetClients(ctx context.Context, repoURI, localURI string, logger *log.Logge var githubRepo clients.Repo if localURI != "" { localRepo, errLocal := localdir.MakeLocalDirRepo(localURI) + var retErr error + if errLocal != nil { + retErr = fmt.Errorf("getting local directory client: %w", errLocal) + } return localRepo, /*repo*/ localdir.CreateLocalDirClient(ctx, logger), /*repoClient*/ nil, /*ossFuzzClient*/ nil, /*ciiClient*/ nil, /*vulnClient*/ - fmt.Errorf("getting local directory client: %w", errLocal) + retErr } githubRepo, errGitHub := ghrepo.MakeGithubRepo(repoURI) @@ -55,12 +59,15 @@ func GetClients(ctx context.Context, repoURI, localURI string, logger *log.Logge } ossFuzzRepoClient, errOssFuzz := ghrepo.CreateOssFuzzRepoClient(ctx, logger) - + var retErr error + if errOssFuzz != nil { + retErr = fmt.Errorf("getting OSS-Fuzz repo client: %w", errOssFuzz) + } // TODO(repo): Should we be handling the OSS-Fuzz client error like this? return githubRepo, /*repo*/ ghrepo.CreateGithubRepoClient(ctx, logger), /*repoClient*/ ossFuzzRepoClient, /*ossFuzzClient*/ clients.DefaultCIIBestPracticesClient(), /*ciiClient*/ clients.DefaultVulnerabilitiesClient(), /*vulnClient*/ - fmt.Errorf("getting OSS-Fuzz repo client: %w", errOssFuzz) + retErr }