go-github
go-github copied to clipboard
PushEvent GetCommits() Method
I would like to use an interface for this event in a local implementation, but unfortunately a getter for this type doesn't exist. Can we create a getter for PushEvent.GetCommits?
type PushEvent struct {
...
Commits []*HeadCommit
...
}
func (p *PushEvent) GetCommits() []*HeadCommit {
return p.Commits
}
In general, getters are only provided for anything where a nil might be a problem (which is not the case for slices of anything), and all getters are auto-generated.
So if you want to add one for this, then I suppose we have a few options:
- add getters for all fields, but that seems wasteful
- modify the auto-generator to add a list of "special" getters that we want to always add (e.g.
PushEvent.Commits) - manually add a getter to the main source code and completely ignore the auto-generator
I'm kinda leaning toward option 2.
Thoughts?
2 sounds good to me 😸 Let me take a look at the auto-generator code. Thank you!
I would like to propose some changes and request for a review.
- https://github.com/google/go-github/pull/2776
I would appreciate it if you could check it out!