Uh oh!
There was an error while loading. Please reload this page.
Support array type in go generate with whitelist - #2776
Conversation
Codecov Report
@@ Coverage Diff @@## master #2776 +/- ##
=======================================
Coverage 98.05% 98.05% =======================================
Files 132 132 Lines 11638 11638 =======================================
Hits 11412 11412 Misses 154 154 Partials 72 72 |
gmlewis
left a comment
There was a problem hiding this comment.
While I appreciate what you are trying to do, @olibaa, this is not how I think it should be done.
Please read very carefully what I wrote here.
I do not want to add getters for every possible slice.
They are simply unnecessary and add a huge amount of bloat for zero benefit.
What I recommend here is that you add a whitelist of fields that your code should process.
So, for example, we have only a single field currently that we want to add to the whitelist: PushEvent.Commits.
Then, on lines 140-142 of github/gen-accessors.go, you would check this whitelist and only call t.addArrayType if the current field matches an item in the whitelist (which itself could simply be a var whitelistSliceGetters = map[string]bool{ ...: true} to make lookup super-easy).
That way, when we look at the diffs of github/github-accessors.go and github/github-accessors_test.go, we should only see one new field in this PR... the one for PushEvent.Commits.
How does that sound to you?
Uh oh!
There was an error while loading. Please reload this page.
olibaa
commented
May 1, 2023
@gmlewis |
Uh oh!
There was an error while loading. Please reload this page.
support array type in go generate with whitelist
6fdb39d to
ff7fd8cComparegmlewis
commented
May 14, 2023
Thank you, @valbeat ! |
Fixes: #2425
This PR is similar to the following PR: