fix(ci): remove variadic arg from Cross target

mage does not support variadic function parameters as targets,
causing 'Unknown target specified: cross' in CI.
This commit is contained in:
zarazaex69
2026-05-24 18:12:16 +03:00
parent 52bce4f9b2
commit be0f0906e4

View File

@@ -39,13 +39,11 @@ func BuildCLI() error {
return buildBinary("olcrtc", "./cmd/olcrtc", goos, goarch) return buildBinary("olcrtc", "./cmd/olcrtc", goos, goarch)
} }
// Cross builds olcrtc for specified platforms or all if none specified. // Cross builds olcrtc for all supported platforms.
// Usage: mage cross [platforms...] func Cross() error {
// Example: mage cross linux/amd64 windows/amd64
func Cross(platforms ...string) error {
mg.Deps(Deps) mg.Deps(Deps)
allTargets := []struct{ os, arch string }{ targets := []struct{ os, arch string }{
{"linux", "amd64"}, {"linux", "amd64"},
{"linux", "arm64"}, {"linux", "arm64"},
{"windows", "amd64"}, {"windows", "amd64"},
@@ -57,28 +55,6 @@ func Cross(platforms ...string) error {
{"openbsd", "arm64"}, {"openbsd", "arm64"},
} }
var targets []struct{ os, arch string }
if len(platforms) == 0 {
targets = allTargets
} else {
wanted := make(map[string]bool)
for _, p := range platforms {
wanted[p] = true
}
for _, t := range allTargets {
key := t.os + "/" + t.arch
if wanted[key] {
targets = append(targets, t)
}
}
if len(targets) == 0 {
return fmt.Errorf("no valid platforms specified. Available: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64, freebsd/amd64, freebsd/arm64, openbsd/amd64, openbsd/arm64")
}
}
for _, t := range targets { for _, t := range targets {
if err := buildBinary("olcrtc", "./cmd/olcrtc", t.os, t.arch); err != nil { if err := buildBinary("olcrtc", "./cmd/olcrtc", t.os, t.arch); err != nil {
return err return err