The title mostly says it. I know that I can do
set GOOS=linux
set GOARCH=amd64
in cmd before I go build
, but I'm trying to write a build script and do it all with exec.Command.
My go build -o etc
works with exec.Command (it builds), but when printing out GOOS in a test script after either of this commands:
cmd := exec.Command("set", "GOOS=linux")
// OR
cmd := exec.Command("set GOOS=linux")
I get windows
.
Any ideas? Thanks!