Skip to content

refactor!: Change GitService methods to pass required params by-value instead of by-ref - #3654

Merged
gmlewis merged 1 commit into
google:masterfrom
rupokghosh:rupok/change-pointer-params-to-values
Aug 4, 2025
Merged

refactor!: Change GitService methods to pass required params by-value instead of by-ref#3654
gmlewis merged 1 commit into
google:masterfrom
rupokghosh:rupok/change-pointer-params-to-values

Conversation

@rupokghosh

@rupokghoshrupokghosh commented Jul 27, 2025

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: GitService methods now pass required params by-value instead of by-ref.

What problem are you solving?

Notes

This is most likely going to be a multi PR issue, since this is my first time working on this codebase. I started by picking a "service" area ( Git ) and converted each function that I thought met the criteria set in the issue mentioned, which are:

  1. The input is required (not optional)
  2. The function does not modify the input

@rupokghosh
rupokghosh marked this pull request as ready for review July 27, 2025 21:32
@gmlewisgmlewis changed the title refactor: convert required pointer params to valuesrefactor: Change required params from pointers to valuesJul 27, 2025
@gmlewis

Copy link
Copy Markdown
Collaborator

Please follow step 4 in CONTRIBUTING.md and push the changes to this PR.

@rupokghosh
rupokghoshforce-pushed the rupok/change-pointer-params-to-values branch from d124f0e to 826440eCompareJuly 28, 2025 01:26
@rupokghosh

Copy link
Copy Markdown
ContributorAuthor

done ✔️ @gmlewis

Comment threadexample/commitpr/main.go Outdated
Comment threadexample/commitpr/main.go Outdated
@codecov

codecovBot commented Jul 28, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.20%. Comparing base (17f7ee4) to head (92a65bb).
⚠️ Report is 1 commits behind head on master.

Files with missing linesPatch %Lines
example/commitpr/main.go0.00%6 Missing ⚠️
github/git_refs.go80.00%2 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## master #3654 +/- ##
==========================================
- Coverage 91.25% 91.20% -0.05% 
==========================================
Files 185 185 Lines 16378 16360 -18 ==========================================
- Hits 14945 14921 -24 - Misses 1249 1254 +5 - Partials 184 185 +1 

☔ 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.

Comment threadgithub/git_refs.go Outdated
@gmlewisgmlewis added the Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). label Jul 31, 2025
@gmlewisgmlewis changed the title refactor: Change required params from pointers to valuesrefactor!: Change required params from pointers to valuesJul 31, 2025
@rupokghosh
rupokghoshforce-pushed the rupok/change-pointer-params-to-values branch 2 times, most recently from 64a09b4 to d813b23CompareAugust 2, 2025 22:23
@gmlewisgmlewis added the NeedsReview PR is awaiting a review before merging. label Aug 2, 2025

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @rupokghosh!
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@alexandear

Copy link
Copy Markdown
Contributor

Please extend the PR header to mention that only GitService is affected by this PR.

@gmlewisgmlewis changed the title refactor!: Change required params from pointers to valuesrefactor!: Change GitService endpoints to pass required params by-value instead of by-refAug 4, 2025
@gmlewis

Copy link
Copy Markdown
Collaborator

@alexandear - how's that?

@gmlewisgmlewis changed the title refactor!: Change GitService endpoints to pass required params by-value instead of by-refrefactor!: Change GitService methods to pass required params by-value instead of by-refAug 4, 2025
@gmlewis

Copy link
Copy Markdown
Collaborator

Whups, I think "methods" is better than "endpoints", agreed?

Comment threadgithub/git_refs.go Outdated
Comment threadgithub/git_refs.go Outdated
Comment threadgithub/git_tags.go Outdated
@rupokghosh
rupokghoshforce-pushed the rupok/change-pointer-params-to-values branch from d813b23 to 939e78aCompareAugust 4, 2025 14:36
@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Aug 4, 2025
update exmaples
change to using values
refactor(git)!: improve CreateRef API with value types and exported struct
format
new updateref struct
remove backwards compatibility
create tag in git tags
slfhg
@rupokghosh
rupokghoshforce-pushed the rupok/change-pointer-params-to-values branch from 939e78a to 92a65bbCompareAugust 4, 2025 18:51
@rupokghosh

Copy link
Copy Markdown
ContributorAuthor

let me know if we can merge this in now!

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @rupokghosh and @alexandear!
LGTM.
Merging.

@gmlewis
gmlewis merged commit db8be8b into google:masterAug 4, 2025
5 of 7 checks passed
JamBalaya56562 added a commit to JamBalaya56562/go-github that referenced this pull request Jun 25, 2026
…Release
Introduce dedicated CreateReleaseRequest and UpdateReleaseRequest types
for the bodies of RepositoriesService.CreateRelease and
RepositoriesService.UpdateRelease, replacing the *RepositoryRelease
parameter that also carried response-only fields. The new types are
passed by value and serialized directly, dropping the internal
repositoryReleaseRequest remap. EditRelease is renamed to UpdateRelease
for naming consistency.
This follows the value-parameter pattern established by the merged
google#3654, google#3794 and google#4320, the Edit -> Update rename from google#4320, and the
dedicated *Request body convention already used across the package (e.g.
CreateHostedRunnerRequest). The runtime nil checks are removed since a
value parameter makes them unnecessary. No deprecated wrappers are added
(clean break).
Updates google#3644.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JamBalaya56562 added a commit to JamBalaya56562/go-github that referenced this pull request Jun 25, 2026
…Release
Introduce dedicated CreateReleaseRequest and UpdateReleaseRequest types
for the bodies of RepositoriesService.CreateRelease and
RepositoriesService.UpdateRelease, replacing the *RepositoryRelease
parameter that also carried response-only fields. The new types are
passed by value and serialized directly, dropping the internal
repositoryReleaseRequest remap. EditRelease is renamed to UpdateRelease
for naming consistency.
This follows the value-parameter pattern established by the merged
google#3654, google#3794 and google#4320, the Edit -> Update rename from google#4320, and the
dedicated *Request body convention already used across the package (e.g.
CreateHostedRunnerRequest). The runtime nil checks are removed since a
value parameter makes them unnecessary. No deprecated wrappers are added
(clean break).
Updates google#3644.
JamBalaya56562 added a commit to JamBalaya56562/go-github that referenced this pull request Jun 25, 2026
…Release
Introduce dedicated CreateReleaseRequest and UpdateReleaseRequest types
for the bodies of RepositoriesService.CreateRelease and
RepositoriesService.UpdateRelease, replacing the *RepositoryRelease
parameter that also carried response-only fields. The new types are
passed by value and serialized directly, dropping the internal
repositoryReleaseRequest remap. EditRelease is renamed to UpdateRelease
for naming consistency.
This follows the value-parameter pattern established by the merged
google#3654, google#3794 and google#4320, the Edit -> Update rename from google#4320, and the
dedicated *Request body convention already used across the package (e.g.
CreateHostedRunnerRequest). The runtime nil checks are removed since a
value parameter makes them unnecessary. No deprecated wrappers are added
(clean break).
Updates google#3644.
JamBalaya56562 added a commit to JamBalaya56562/go-github that referenced this pull request Jun 26, 2026
…Release
Introduce dedicated CreateReleaseRequest and UpdateReleaseRequest types
for the bodies of RepositoriesService.CreateRelease and
RepositoriesService.UpdateRelease, replacing the *RepositoryRelease
parameter that also carried response-only fields. The new types are
passed by value and serialized directly, dropping the internal
repositoryReleaseRequest remap. EditRelease is renamed to UpdateRelease
for naming consistency.
This follows the value-parameter pattern established by the merged
google#3654, google#3794 and google#4320, the Edit -> Update rename from google#4320, and the
dedicated *Request body convention already used across the package (e.g.
CreateHostedRunnerRequest). The runtime nil checks are removed since a
value parameter makes them unnecessary. No deprecated wrappers are added
(clean break).
Updates google#3644.
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
…ue instead of by-ref (google#3654)
BREAKING CHANGE: `GitService` methods now pass required params by-value instead of by-ref.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rupokghosh@gmlewis@alexandear