- Cross-compile linux program with powershell in VS Code on Windows system
$env:GOOS="linux" $env:GOARCH="amd64" go build -ldflags "-s -w" -o BIN SRC.go
- Cross-compile windows program on linux system
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o BIN SRC.go
- Cross-compile Arm program on linux system
GOOS=linux GOARCH=arm go build -ldflags "-s -w" -o BIN SRC.go