Today I started working on a web app to automatically build and store releases that I could submit, for all operating systems and architectures. I stumbled upon an issue which I couldn’t solve myself.
So I wanted to go build for each operating system, and tried setting the GOOS and GOARCH in the Default context in the build package, then using exec.Command(“go”, “build”). All seemed well, but it turned out it would all just build the same executable, for windows.
I’m out of ideas, and don’t know how to build with a different GOOS and GOARCH inside of Go code. I hope someone can help me with it.