-2

All the examples I've found so far assume you are using a Mac and compile for the other platforms.

zen
  • 79
  • 1
  • 9

1 Answers1

2

As stated you can set the GOOS and GOARCH.

you can check all the distro using the following go command

go tool dist list

How to build the application for MacOS

GOOS=darwin GOARCH=amd64 go build main.go
Bobby
  • 21
  • 1
  • 1
  • 5
    That notation (`GOOS=darwin ...`) is for bash (and some other shells) but not windows (CMD/powershell) which is the focus of this question. [This answer](https://stackoverflow.com/a/50080193/11810946) describes a way of setting variables and running a program in one line on windows. – Brits Sep 28 '21 at 04:42
  • yes, that was it – zen Sep 28 '21 at 05:59