-
Couldn't load subscription status.
- Fork 459
✨ Add --load-build-tags flag
#1161
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
|
Taking my self-approved label off to get another approver's approval (say that 10 times fast! 😄) |
|
Any update on this @joelanford ? |
| return printMarkerDocs(c, rawOpts, whichLevel) | ||
| } | ||
|
|
||
| // otherwise, set up the runtime for actually running the generators |
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.
loader.LoadRootsWithConfig
// put our build flags first so that callers can override them
l.cfg.BuildFlags = append([]string{"-tags", "ignore_autogenerated"}, l.cfg.BuildFlags...)Is it correct that by adding -tags here we overwrite -tags", "ignore_autogenerated"?
What about using ignore_autogenerated as the default value for our flag?
I think this probably (?) would result in:
- the same behavior as before if the flag is not set by users
- allows to add additional tags
- allows to disable ignore_autogenerated
(not entirely sure, would be good to double check)
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 require one to remember to add ignore_autogenerated but it's the most flexible.
Unless we think that ignore_autogenerated is required?
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.
Good catch. Yes, it appears as if ignore_autogenerated will not be used if tags are provided on the command line.
I implemented a small test project to check behavior. The last -tags flag wins, and all previous tags flags are ignored.
So the behavior of what is in the PR now is:
- If no tags are passed in the flag, then the last tags flag is "ignore_autogenerated", and that's what is used.
- If any tags are passed in the flag, "-tags=ignore_autogenerated" is ignored. Only explicit user-defined tags are used.
So I think putting ignore_autogenerated in the default flag value actually has the same outcome, but it is also more explicit, and it makes it easier for our future selves to avoid the question if what happens when -tags is used multiple times.
I can't think of a good reason to force ignore_autogenerated. I think it is better to make that the default but then let a user override that and pass their desired set of tags, which may or may not include ignore_autogenerated.
I'll update the PR to account for this convo.
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.
Oh, there's one problem moving ignore_autogenerated to the flag default. Users of loader.LoadRoots and loader.LoadRootsWithConfig (and any other functions up the call stack that call those functions) will be broken because those functions would suddenly stop including that build tag.
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.
So perhaps we put ignore_autogenerated in the flag default (for visibility/clarity), but then also keep a separate (and overridable) -tags=ignore_autogenerated build flag hardcoded in LoadRootsWithConfig with some heavy comments explaining the situation.
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.
Makes sense to me
|
Thx! /lgtm |
|
LGTM label has been added. Git tree hash: ebdca06b18b31d24463329f042454cc8f49cc3ef
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joelanford, sbueringer 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 |
|
/cherry-pick release-0.17 |
|
@sbueringer: #1161 failed to apply on top of branch "release-0.17": In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@joelanford @tmshort I created the release-0.17 branch from the commit right before we bumped to the next k8s.io/* minor dependencies. We don't always create release branches in controlller-tools. We just keep releasing patch versions from main until the next minor. But in this case we shouldn't because then we would include the 0.33 k8s.io/* depedencies. Can you plesae open a "manual" cherry-pick PR against release-0.17? |
Fixes #1158
An alternative to #1160