Skip to content

Commit

Permalink
Fix cmd panic (#1692)
Browse files Browse the repository at this point in the history
Co-authored-by: Azeem Shaikh <[email protected]>
  • Loading branch information
azeemshaikh38 and azeemsgoogle authored Mar 1, 2022
1 parent 8377294 commit 738b246
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions checker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

0 comments on commit 738b246

Please sign in to comment.