Skip to content

Conversation

@rhuss
Copy link
Contributor

@rhuss rhuss commented Jun 4, 2025

  • Added SilenceUsage: true to the command configuration to suppress usage messages.
  • Simplified error handling in the GitHub client by removing unnecessary buffer variable.

- Added `SilenceUsage: true` to the command configuration to suppress usage messages.
- Simplified error handling in the GitHub client by removing unnecessary buffer variable.
@openshift-ci openshift-ci bot requested review from cardil and dsimansk June 4, 2025 17:45
@openshift-ci
Copy link

openshift-ci bot commented Jun 4, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rhuss
Once this PR has been reviewed and has the lgtm label, please assign cardil for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

cl.ProjectDir = c.Project.Path
buff, err := cl.Execute(c.Context)
defer c.Println("Github client:", buff)
_, err = cl.Execute(c.Context)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing the Print entirely?

I can agree to remove it if err == nil. Otherwise, the GitHub Client output might contain important debugging info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually for me the output was just an array of ints (that can be decoded to some URLs). It was not even useful in the error case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we can keep it for the error case, sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. It's a []byte not string.

It should be decoded before printing. Similarly, like here:

if err != nil {
return nil, errors.Wrap(err, ErrSyncFailed)
}
un := make([]map[string]interface{}, 0)
err = json.Unmarshal(buff, &un)
if err != nil {
return nil, errors.Wrap(err, ErrSyncFailed)
}
if len(un) > 0 {
u := fmt.Sprintf("%s", un[0]["url"])
return &u, nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants