-
Notifications
You must be signed in to change notification settings - Fork 651
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
bpf2go: some options take defaults from the environment #1047
Conversation
a2bfb47
to
0d22505
Compare
Originally I didn't add this because
allows you to set the makebase once, in the main Makefile. See tubular for an example. This has the benefit that you can easily grep a project and figure out where the variable is used. Would this solve your problem as well? |
@lmb That's what I started with (see referenced discussion).
Further, I would argue that using I understand the value in being able to grep for things. However, doesn't |
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.
Yeah adding that convenience is fine for me. I agree that -makebase
should always be used with an env variable anways. I have a couple of requests though. If we're adding env support, let's add some more:
- BPF2GO_CC
- BPF2GO_STRIP
- BPF2GO_CFLAGS
- Any others stand out?
Instead of cluttering individual flags help texts, why not update helpText
and mentioned that some flags may default to environment variables and only mention the vars in the per-flag text? Something like write make compatible depinfo files relative to directory ($BPF2GO_MAKEBASE)
.
Can you also document that flags always take precedence over env variables?
Finally it would be the icing on the cake if you manage to add unit tests.
It's not clear to me how to tackle it best:
|
Yeah that would be great. Seems like it should be possible to split just above here? Line 195 in 940221e
|
0d22505
to
e7dd853
Compare
@lmb I am not very happy with the help text but don't have any ideas how to improve it:
|
e7dd853
to
8ee44b2
Compare
Introduce BPF2GO_CC, BPF2GO_CFLAGS, BPF2GO_STRIP and BPF2GO_MAKEBASE. Signed-off-by: Nick Zavaritsky <mejedi@gmail.com>
8ee44b2
to
0b84b08
Compare
@lmb Thank you for the review. I've done requested changes. |
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 great, thanks for working on this!
Adds
BPF2GO_CC
,BPF2GO_CFLAGS
,BPF2GO_STRIP
andBPF2GO_MAKEBASE
.The rationale for
BPF2GO_MAKEBASE
:This is in addition to existing -makebase option.
When used in go:generate line, the existing option requires a relative path from current package directory to the one with the Makefile. (While absolute pathes are accepted, we can't write one since we don't know where a user puts the project in the filesystem.)
Relative paths WILL break as packages move around. The environment variable, on the other hand, can be set in the Makefile once and doesn't require further maintenance.
See #988 (reply in thread)