I am writing a script that will download the executable binary from Google cloud storage and execute it on the Google cloud compute.
But, I don't know what would be the right values for GOOS
and GOARCH
environment variables to build the executable with go build
command.
Container-Optimized OS is a Linux derivate, and to the best of my knowledge all GCE instances are x86_64 machines. This machine is a n1-standard-1 with the stable COS image:
user@instance-1 ~ $ uname -a
Linux instance-1 4.4.111+ #1 SMP Thu Apr 5 21:21:21 PDT 2018 x86_64 Intel(R) Xeon(R) CPU @ 2.50GHz GenuineIntel GNU/Linux
So to build for COS use
GOOS=linux GOARCH=amd64