-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add WithCallback Feature #3681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WithCallback Feature #3681
Conversation
Not-Dhananjay-Mishra
commented
Aug 16, 2025
Corrected the typo that caused the lint issue. I’m still learning, so thank you
@gmlewis
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @Not-Dhananjay-Mishra - but I don't think this fully satisfies what is being requested in #3658.
Additionally, discussion has not completed in that issue, as there is an outstanding request to the original author to further clarify their request, so it is premature to be writing any PR for that issue yet.
Let's hold off on this PR until we get some more clarity, please.
Not-Dhananjay-Mishra
commented
Aug 16, 2025
Thanks @gmlewis for the clarification! I will hold off on the PR. I appreciate the guidance.
This PR implements the feature requested in [#3658] to allow configurable telemetry for the Client.
Modifications -
WithCallback(callback func())was added. The callback will be set by the user.client.bareDoinsideclient.Do.func(), which default set to nil duringinitialize().Example Code -
client := github.NewClient(nil).WithCallback(func() {fmt.Println("Callback executed")})This enables users to attach custom telemetry or logging kind of things to API calls in a flexible, user friendly manner.
Btw this is my first PR
Happy to get any feedback or suggestions to improve it