Separate the contents of a particular platform into a separate file, for example. stuff.go
Now replace stuff.go with versions for different platforms, for example stuff_darwin.go (for Mac), stuff_windows.go, stuff_linux.go, etc.
If the file has this suffix, the go command will compile it only on the specified platform.
source share