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
cmd/bpf2go: read more flags from environment #1284
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for the patch! Left a small nit, and would like @lmb's sign-off on this as well.
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.
Left some questions. Could you extend the unit tests in main_test.go
to cover the new variables?
Signed-off-by: Puqns67 <me@puqns67.icu>
if !ok { | ||
return defaultVal | ||
} | ||
result, _ := strconv.ParseBool(val) |
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.
This error should be surfaced to the user, otherwise incorrect settings like NO_STRIP=gobbledigook
will silently disable stripping.
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.
This error should be surfaced to the user, otherwise incorrect settings like
NO_STRIP=gobbledigook
will silently disable stripping.
I made some of these changes, what do you think?
result, _ := strconv.ParseBool(val) | |
result, err := strconv.ParseBool(val) | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "Warning: The value '%s' passed from environment variable '%s' is undefined in strconv.ParseBool, using default value (%t).\n", val, key, defaultVal) | |
return defaultVal | |
} |
What else should I change?
Do I need to use b2g.stdout instead of os.Stderr? (Need to add a parameter to pass writer)
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.
A warning is nice, what about just returning the error from the function instead? That means you need to add a separate block to add it to run()
but that isn't so bad in my opinion.
No description provided.