-
Notifications
You must be signed in to change notification settings - Fork 17
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
Adds the possibility to configure go build
flags
#51
Conversation
… the generated binary)
Hi @thgruiz, thanks for the PR and sorry for the slow response, this seems to have fallen between the cracks :( |
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.
Sorry for this taking so long, we are about to release a new k6 version and I keep forgetting to look at this.
// trim debug symbols by default | ||
buildFlags := b.osEnvOrDefaultValue("XK6_BUILD_FLAGS", "-ldflags=-w -s") |
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 am not certain if we don't want to not have this as the default 🤔
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.
But maybe leave that for a separate PR later as I guess we will need to discuss it with the team more 🤷 . I personally don't think the extra space is a problem, but maybe there are other reasons to trim them by default
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 did test it locally and seems to work perfectly 👏
So if we can just do the requested changes I think we can merge this
WDYT @imiric
Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com>
…any build flags Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com>
I have committed to the suggestions you gave, @mstoykov Thanks for the reviews and comments! (sorry for my delay, though.) |
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 to me 🎉
Thanks for all the work 🙇
…than one quoted/composite flags in it
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 @thgruiz! 👏 This now closes #4, #43 and #48 🎉
I would prefer to see some tests, preferably E2E by setting XK6_BUILD_FLAGS
, but that goes into #13 territory, so we could tackle it later. But now that buildCommandArgs()
is a standalone function, it should be straightforward to add some unit tests for it. I won't block this for merging, but would appreciate it if you added some. 🙏
// buildComandArgs parses the build flags passed by environment variable XK6_BUILD_FLAGS | ||
// or the default values when no value for it is given | ||
// so we may pass args separately to newCommand() | ||
func buildComandArgs(buildFlags, absOutputFile string) (buildFlagsSlice []string) { | ||
|
||
buildFlagsSlice = make([]string, 0, 10) |
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.
// buildComandArgs parses the build flags passed by environment variable XK6_BUILD_FLAGS | |
// or the default values when no value for it is given | |
// so we may pass args separately to newCommand() | |
func buildComandArgs(buildFlags, absOutputFile string) (buildFlagsSlice []string) { | |
buildFlagsSlice = make([]string, 0, 10) | |
// buildCommandArgs parses the build flags passed by environment variable XK6_BUILD_FLAGS | |
// or the default values when no value for it is given | |
// so we may pass args separately to newCommand() | |
func buildCommandArgs(buildFlags, absOutputFile string) (buildFlagsSlice []string) { | |
buildFlagsSlice = make([]string, 0, 10) |
go build
flags
Merging this as is, since it fixes some important issues. Thanks for your work @thgruiz! We'll fix the remaining issues and maybe add tests for this as well. |
to use dlv with the generated binary, as described here: #43