-
Notifications
You must be signed in to change notification settings - Fork 1.7k
_codegen: copy dependency github.com/ernesto-jimenez/gogen/imports #1782
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
base: master
Are you sure you want to change the base?
Conversation
Copy code from dependency github.com/ernesto-jimenez/gogen/imports (which hasn't evolved since 2018) as package _codegen/internal/imports. This is imported from https://github.com/ernesto-jimenez/gogen at commit d7d4131e6607813977e78297a6060f360f056a97. See https://github.com/ernesto-jimenez/gogen/tree/d7d4131e6607813977e78297a6060f360f056a97/imports The license block is added to match the LICENSE file from the source repository.
Use our imported copy of package github.com/ernesto-jimenez/gogen/imports to remove one external dependency.
This doesn't bring the commit history from source repo, just the files. Should we bring in a subtree instead, or do you think this is a better approach? I know the subtree has proven extremely difficult to re-base. |
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.
LGTM 👍
A few remarks anyway
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.
I would add a README file aside this one mentioning where the code come from (its URL) and why it was imported (the reason)
Also I would add a LICENCE file instead of this header.
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 imported code and testify are both MIT licenced, the MIT license of testify applying to the now embedded codegen package is quite correct.
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.
Indeed, what about the README file then?
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.
My aim is to get rid of the package and to replace the code from that package with code in _codegen/main.go
.
The source URL is in the commit message and in this PR should be enough to document history.
I've assigned @ernesto-jimenez as a reviewer as he wrote that code and was also a maintainer of Testify, so his opinion is what matters the most to me.
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.
No objections from my side :)
@brackendawson wrote:
I don't think we need the history for the file. My goal is to get rid of the code we don't need in that package, and may be ultimately move the few things we use into Also we don't need a test suite for that package: we just need the code generation to work with the minimum maintainable code, so the code generation output is the test suite. |
Code is always more maintainable when it has tests. The code you've copied in verbatim had one test which you have not vendored. Why are we not bringing that too? |
Summary
Remove external dependency on module
github.com/ernesto-jimenez/gogen
by copying its packagegithub.com/ernesto-jimenez/gogen/imports
(MIT license) as_codegen/internal/imports
.Changes
github.com/ernesto-jimenez/gogen/imports/imports.go
as_codegen/internal/imports/imports.go
and add a license block to the file_codegen/main.go
and_codegen/go.mod
.Motivation
The removal of this external dependency (by duplicating its code) improves the control of our source code. It will also allow more refactoring of the codegen steps (in particular this now allow to remove the separate go module).
Cc: @ernesto-jimenez