-
Naming file with build restriction foo_${GOOS}.go
-
Adding build directives to the top of the file //+build linux,386 darwin windows
-
on build system set $GOOS variable to target system (no matter which OS is your build system linux<>windows) GOOS = windows go build main.go
-
cpu architecture can be set GOARCH=386 go build main.go
-
check file type file main.exe (linux/wsl)
Credits: (Caskey L. Dickson)[https://youtu.be/COCUqAwAbD0]