-
Notifications
You must be signed in to change notification settings - Fork 226
Refactor pkg/generate
package
#120
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
Conversation
42e3cf6
to
540f78f
Compare
NOTE to reviews: please give this PR a manual merge. It will simplify the rebase of #121 |
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.
Wondering why this refactor PR has a bunch of new files and methods in it. Also do you know if the generator is referenced in other documentation (such as in community
) or in the Godocs, that might need changing? I understand doing a search all for "generator" could return a lot of false positives, but I worry that a change this large may introduce a fragmented understanding of the code.
@RedbackThomson This will not impact the existing godocs, since we are keeping the same methods for |
/hold reworking the refactor |
This patch renames every `generate.Generator` mention to `model.Model`, also all the variables and parameters that were used to represent a generator (for example `g` for generator).
This patch moves all unit tests in `pkg/generate` (tests for the old `generate.Generator`) to `pkg/model`. Also moves all testdata to `pkg/testdata` and update `testutil.NewModelForService` to properly build the test data path for both `pkg/model` and `pkg/generate/code` uni tests
@RedbackThomson i pushed new refactoring commits conserving the |
New refactoring is that you've moved |
Yes exactly, also moved generator unit tests under |
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.
Yes, excellent.
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.
Agree this makes a lot more sense. Great!
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, jaypipes, RedbackThomson, vijtrip2 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 |
Issue N/A
During
code-generator
early days,generate.Generator
used to havemethods that generated controllers, apis and resources code. After few
refactoring iterations the code that outputs controllers Go code is
now situated in
pkg/generate/ack
, andgenerate.Generator
onlycontains methods to read/load CRDs and Type Definitions.
This PR contains two commits. The first one renames
pkg/generate.Generator
to
pkg/model.Model
and the second movesgenerator
unit tests topkg/model
and
pkg/generate/testdata
topkg/testdata
Description of changes:
pkg/generate.Generator
topkg/model.Model
, also renamesall the variables and parameters that were used to represent a generator.
pkg/generate/testdata
topkg/testdata
pkg/generate
unit tests topkg/model
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.