#!/usr/bin/env bash set -euo pipefail LDFLAGS='-s -w' TARGETS=( "linux/amd64/pcli-linux-amd64" "darwin/amd64/pcli-darwin-amd64" "darwin/arm64/pcli-darwin-arm64" "windows/amd64/pcli-windows-amd64.exe" ) for target in "${TARGETS[@]}"; do IFS='/' read -r os arch output <<< "$target" echo "Building ${os}/${arch} -> ${output}" CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -ldflags="$LDFLAGS" -o "$output" . done # Symlink the linux binary as the default 'pcli' for local use ln -sf pcli-linux-amd64 pcli echo "" echo "Built all targets:" ls -l pcli-* pcli.exe 2>/dev/null || true