I have GO 1.7 installed on my Windows 10. I created test program and it works perfectly in Windows. Next step is to try to run it on my docker virtual machine with Ubuntu.
I found here some info about the way to do it
set GOARCH=amd64
set GOOS=linux
go tool dist install -v pkg/runtime
go install -v -a std
I run line 1 and 2 in cmd and there is no problem. At line 3 I have an error
go tool dist: open C:\Go\src\pkg\runtime: The system cannot find the path specified.
I check manually this folder and there is a runtime only for windows
The question is where and how can I download it for linux? Or maybe thats I'm doing is completely wrong way...
UPDATE 09/02/2017
I ran like it was suggested
set GOARCH=amd64
set GOOS=linux
go build -o "myapp"
After I copied this file to shared folder, copied form there to another not shared folder (to avoid an issue described here) and executed
root@7dd1655ae5db:/__notshared# ./myapp
bash: ./myapp: cannot execute binary file: Exec format error
After I downloaded file package checked my file
root@7dd1655ae5db:/__notshared# file myapp
myapp: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
It seems that during build not linux executable was created.