From 8541bdd8586f050afd9e7713bb68267c54a9e67c Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 13 Apr 2026 02:59:55 +0900 Subject: internal/rosa: wrap per-arch values This is cleaner syntax in some specific cases. Signed-off-by: Ophestra --- internal/rosa/rosa.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal/rosa/rosa.go') diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index 560f10d5..930a1896 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -69,6 +69,18 @@ func triplet() string { return linuxArch() + "-rosa-linux-musl" } +// perArch is a value that differs per architecture. +type perArch[T any] map[string]T + +// unwrap returns the value for the current architecture. +func (p perArch[T]) unwrap() T { + v, ok := p[runtime.GOARCH] + if !ok { + panic("unsupported target " + runtime.GOARCH) + } + return v +} + const ( // EnvTriplet holds the return value of triplet. EnvTriplet = "ROSA_TRIPLE" -- cgit v1.3.1