Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Fix bug in Windows rake command #323

Merged
merged 2 commits into from
Oct 12, 2017
Merged

Conversation

bmermet
Copy link

@bmermet bmermet commented Oct 10, 2017

The command to build the windows target was broken because of mistake when concatenating the two parts of the command.

@bmermet bmermet changed the title Fix bug in Window rake command Fix bug in Windows rake command Oct 10, 2017
@bmermet bmermet requested review from palazzem and talwai October 10, 2017 20:31
Rakefile Outdated
@@ -96,7 +96,7 @@ task :windows do
set_env = "GOOS=windows GOARCH=#{arch}"
end
go_build("github.com/DataDog/datadog-trace-agent/agent", {
:cmd => set_env + " go build -a -o trace-agent-windows-#{arch}.exe",
:cmd => set_env + "&& go build -a -o trace-agent-windows-#{arch}.exe",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOS=windows GOARCH=#{arch} && go build -a -o trace-agent-windows-#{arch}.exe

could be a full command? not sure it works when os doesn't evaluate to windows.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially the command worked only on UNIX, I added the windows case a couple of months ago. It does work when the os doesn't evaluate to windows because the go compiler is able to cross compile.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is if the command above is executed that way, because it doesn't work if it's the case:

$ GOOS=windows env | grep GOOS
# -> GOOS=windows
$ GOOS=windows && env | grep GOOS
# -> returns nothing because the ENV variable is not set since `env` is executed as a second command

So my question is if a code path can generate the command I wrote in the previous comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what you mean :S
On Windows the command that gets executed is:
set "GOOS=windows" && set "GOARCH=386"&& go build -a -o trace-agent-windows-386.exe ...
And on other platforms it is:
GOOS=windows GOARCH=386&& go build -a -o trace-agent-windows-386.exe ...

Both commands are working and produce windows binaries, the difference is due to the way environment variables are set in Windows and Unix.

Can you elaborate on what may not be working?

Copy link

@palazzem palazzem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to me!

@talwai talwai merged commit 38da8fe into master Oct 12, 2017
@dtilghman dtilghman deleted the bmermet/buginwindowsrakefile branch October 13, 2017 05:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants