-
Notifications
You must be signed in to change notification settings - Fork 143
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
[crossbuild] Fix path separators #3310
[crossbuild] Fix path separators #3310
Conversation
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
🌐 Coverage report
|
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 don't have windows dev environment to validate.
This change look ok to me.
CI failures are unrelated to the changes in this PR. @pierrehilbert @cmacknz would you mind force merging this PR? |
dev-tools/mage/crossbuild.go
Outdated
// buildCmd will be `\`. But the buildCmd is executed inside a Linux Docker | ||
// container. So we replace all `\` path separators with `/`. | ||
if GOOS == "windows" { | ||
buildCmd = strings.ReplaceAll(buildCmd, "\\", "/") |
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.
would you consider using filepath.ToSlash ? I think if we do that we don't have to have the GOOS == "windows"
check. If the os.PathSeparator
is /
it won't do anything, otherwise it will replace all instances of os.PathSeparator
with /
.
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 like it, thanks for the suggestion @leehinman. Changed in 39daec4.
I let you reply to @leehinman's question and then I will force merge things. |
@leehinman could you review this again please? |
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
I'm force merging as the failures are not related |
* Fix path separators * Use filepath.ToSlash
What does this PR do?
This PR fixes the path separators in the
crossBuild
target, so if this target is invoked on a Windows host, it creates the correct build command to be run inside a Linux-based Docker container.Why is it important?
So we can build Elastic Agent on Windows hosts.
Without this PR, e.g. from
main
, we get the following error while building an Elastic Agent package on a Windows host: