-
Notifications
You must be signed in to change notification settings - Fork 37
Changing handling on all-modules.go and the 'go generate' feature #355
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
Changing handling on all-modules.go and the 'go generate' feature #355
Conversation
Dunno whyni thought this was a good idea. Why don't we just commit the generated file with the current set of modules? Thst makes it simple. Make targets that copy over it need to be updated though |
Would it not invariably change when someone runs "go generate" and then get added to their unstaged files? |
I've had to "re-fork" so many times because I messed up something in my own repository trying to keep it up to date with the upstream one. Anything we can do to make it simple would be much appreciated :-) |
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 think this PR is a good idea overall. We need to go back to how it was, more or less. I think we should include the following:
- Instead of deleting it, run go generate and commit the results
- Remove modules/all-modules.go from .gitignore
- Remove all references to make ungenerate from Makefile
- Delete cmd/generate/_all-modules.go
- Add
sort.Strings(pkgs)
to line 47 inmodule-imports.go
, so that we always get a predictable order of modules (and prevent unnecessary file changes).
This makes go generate an optional "helper" step that can be run only when adding or removing modules.
Changes are all done now. |
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.
Looks good, we still need the initial all-modules.go
to be present (run go generate
and commit results). The CI build fails as will anyone trying to run the project without it.
I actually thought I did. Did I not add it correctly? It was supposed to be this commit: 27c6854 |
My bad, I misinterpreted what I was seeing. |
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.
Looks good, thanks!
I am very happy to help :) |
I forgot to add the sorting - that is now added in the last commit. |
Description
When forking the repository, and running "go generate" modules/all-modules.go is created or updated, but since it was previously tracking in the repository it's then added to unstaged files for commit. This is not optimal, as it could potentially mean someone would push their custom all-modules.go file to the main repository.
It's already in .gitignore, but since it was already tracked this is not enough to have ti not appear as a changed file when running "go generate".
Changes