Hi gophers,
We have been building a large go lang project using modules.
We need to support windows XP (i know it is very weird in 2020 but one of our customer still have hundreds of XP in its fleet).
How would you automate a go1.11 building to support win XP 32?
We currently build go version go1.14.3.
And we also build with go-mobile.
#!/usr/bin/env bash
# The distribution relative path.
DISTRIB_PATH=distributions
for mainGoPath in tplst tplsth/tplsth
do
# Use the last component of the path to determine the executable name
executableName=${mainGoPath##*/};
# Build for our selected targets
# To list supportable targets : "go tool dist list"
echo "Building ${executableName} for mac/darwin 64"
env GOOS=darwin GOARCH=amd64 go build -o ${DISTRIB_PATH}/mac/${executableName} ${mainGoPath}.go
echo "Building ${executableName} for windows 32"
env GOOS=windows GOARCH=386 go build -o ${DISTRIB_PATH}/win32/${executableName}.exe ${mainGoPath}.go
echo "Building ${executableName} for windows 64"
env GOOS=windows GOARCH=amd64 go build -o ${DISTRIB_PATH}/win64/${executableName}.exe ${mainGoPath}.go
echo "Building ${executableName} for Linux 32"
env GOOS=linux GOARCH=386 go build -o ${DISTRIB_PATH}/linux32/${executableName} ${mainGoPath}.go
echo "Building ${executableName} for Linux 64"
env GOOS=linux GOARCH=amd64 go build -o ${DISTRIB_PATH}/linux64/${executableName} ${mainGoPath}.go
echo "Building ${executableName} for Linux ARM7 32"
env GOOS=linux GOARCH=arm GOARM=7 go build -o ${DISTRIB_PATH}/linuxArm7/${executableName} ${mainGoPath}.go
echo "Building ${executableName} for Linux ARM8 64"
env GOOS=linux GOARCH=arm64 go build -o ${DISTRIB_PATH}/linuxArm8/${executableName} ${mainGoPath}.go
done