Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go cross-compilation with 1.5.x - output file is overridden

Tags:

go

I'm using go 1.5 and I'm cross compiling like specified here.

The problem is that when compiling the project it will override the binary the last compilation created. Moreover - I will never know which OS/ARCH the executable file that I'm running was compiled to (in any case that is not windows).

Is there a way to rename the file at compile command?

like image 293
Shikloshi Avatar asked Sep 26 '22 06:09

Shikloshi


1 Answers

You could use the "-o" argument, like this:

GOOS=linux GOARCH=386 CGO_ENABLED=0 go build -o test/output/myapp
like image 97
mihaic Avatar answered Sep 30 '22 06:09

mihaic