-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Refactor 7 return values in parseGitUrl to RepoSpec(issue 4866, Task1) #4900
Refactor 7 return values in parseGitUrl to RepoSpec(issue 4866, Task1) #4900
Conversation
Hi @kishorerj. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @annasong20 |
/ok-to-test |
func parseGitURL(n string) ( | ||
host string, orgRepo string, path string, gitRef string, gitSubmodules bool, gitSuff string, gitTimeout time.Duration) { | ||
func parseGitURL(n string) *RepoSpec { | ||
repoSpec := &RepoSpec{raw: n, Dir: notCloned, Timeout: defaultTimeout, Submodules: defaultSubmodules} |
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.
Is there a reason we initialize Timeout
and Submodules
here?
We should set raw
and Dir
because they remain constant. Their initialized values are the final return values.
On the other hand, Timeout
and Submodules
are always initialized on line 121 below. If they aren't present in n
, parseQuery
returns their default values. We are doing unnecessary work by initializing them here. Would recommend removing.
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.
The reason I am initialising the default values is because I think its good practice to initialize with user defined default values where possible during object creation itself.. If we create any new logic between 114 and 121 in future which will return RepoSpec we can always ensure that RepoSpect has timeout set to the default values that we want (27secs) instead of the type defaults.. That was the reasoning.. please let me know what you think
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.
Ah, I see. That makes sense. Thanks for the explanation!
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.
Looks very clean! Left minor comments.
@kishorerj: This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/lgtm |
/label tide/merge-method-squash Feel free to add this label yourself next time! If you have multiple commits in your PR, this label will squash them into 1 when merged to keep the master branch clean. |
/ok-to-test |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kishorerj, KnVerey The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
kubernetes-sigs#4900) * initial commit to refactor 7 return values in parseGitUrl to RepoSpec * fix review comments
kubernetes-sigs#4900) * initial commit to refactor 7 return values in parseGitUrl to RepoSpec * fix review comments
This PR has been created to fix Task1 in Issue #4866.
The parseGitURL returns 7 values. It has been refactored to return a single RepoSpec value..