Skip to content
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: use go-github getter methods #9

Merged
merged 1 commit into from
Jan 27, 2021
Merged

refactor: use go-github getter methods #9

merged 1 commit into from
Jan 27, 2021

Conversation

suzuki-shunsuke
Copy link
Contributor

@suzuki-shunsuke suzuki-shunsuke commented Jan 26, 2021

Instead of getting value from pointer field directly,
we should get value via go-github getter method.
By getter method, we can prevent panic due to nil.

ex. PullRequest.GetURL: https://pkg.go.dev/github.com/google/go-github/github#PullRequest.GetURL

Instead of getting value from pointer field directly,
we should get value via go-github getter method.
@suzuki-shunsuke suzuki-shunsuke changed the title refactor: use go-github getter API refactor: use go-github getter methods Jan 26, 2021
@chaspy chaspy self-requested a review January 27, 2021 16:33
@@ -173,12 +173,12 @@ func getPRInfos(prs []*github.PullRequest) []PR {
prInfos := make([]PR, len(prs))

for i, pr := range prs {
repos := strings.Split(*pr.URL, "/")
repos := strings.Split(pr.GetURL(), "/")
Copy link
Owner

Choose a reason for hiding this comment

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

Labels: pr.Labels,
User: pr.User.Login,
User: pr.User.GetLogin(),
Copy link
Owner

Choose a reason for hiding this comment

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


prInfos[i] = PR{
Number: pr.Number,
Number: pr.GetNumber(),
Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Owner

@chaspy chaspy left a comment

Choose a reason for hiding this comment

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

Thanks! I learned that there are functions to get each field in the library 😄

@chaspy chaspy merged commit e71c5fa into chaspy:main Jan 27, 2021
@suzuki-shunsuke suzuki-shunsuke deleted the refactor/use-getter-method branch January 27, 2021 22:46
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