aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-13 02:59:55 +0900
committerOphestra <cat@gensokyo.uk>2026-04-13 02:59:55 +0900
commit8541bdd8586f050afd9e7713bb68267c54a9e67c (patch)
treed96888c3fa351edb9c92e08337902a4569d79d67 /internal/rosa/rosa.go
parent46be0b0dc818293b01afb8e33d505b5bbf60f19a (diff)
internal/rosa: wrap per-arch values
This is cleaner syntax in some specific cases. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go12
1 files changed, 12 insertions, 0 deletions
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"