Skip to content

Conversation

@gmlewis
Copy link
Collaborator

@gmlewis gmlewis commented Feb 10, 2026

BREAKING CHANGE: Many *Options structs now pass omitempty URL struct fields by value instead of by reference.

Fixes: #3990.
Relates to: #3984.

Over time, I had allowed and even encouraged pointers to primitive types to be used in the URL struct tags when "omitempty" was provided. This violates the spirit of the purpose of the use of pointers for GitHub resource types as declared in this repo's README.md, and this is the first step to getting back on track to a self-consistent client library.

I apologize for the breakages that this PR causes and for all the contributors whom I wrongly steered during code reviews.

Note that timestamps can still be passed by reference (or by value if using omitzero).

Also note that a new check-structfield-settings tool is added to this repo that will report (and optionally -fix) any obsolete exceptions listed in the .golangci.yml file at the root of the repo.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.52%. Comparing base (c5bf1bc) to head (2b4656b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3991   +/-   ##
=======================================
  Coverage   93.52%   93.52%           
=======================================
  Files         207      207           
  Lines       17593    17593           
=======================================
  Hits        16454    16454           
  Misses        938      938           
  Partials      201      201           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Feb 10, 2026
@gmlewis
Copy link
Collaborator Author

gmlewis commented Feb 10, 2026

If any of you have time to review, that would be greatly appreciated.

cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra

Comment on lines +295 to +298
switch ident.Name {
// Remove the pointer for primitives in url tags
case "string", "int", "int64", "float64", "bool":
return ident.Name, false
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use isBuiltinType helper function?

Suggested change
switch ident.Name {
// Remove the pointer for primitives in url tags
case "string", "int", "int64", "float64", "bool":
return ident.Name, false
// Remove the pointer for primitives in url tags
if isBuiltinType(ident.Name){
return ident.Name, false

@Not-Dhananjay-Mishra
Copy link
Contributor

Also, should we update all the struct in this PR? I believe a lot of struct need to be change

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

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistent use of non-pointer fields in URL option structs

2 participants