1
0
forked from rosa/hakurei

internal/rosa: wrap per-arch values

This is cleaner syntax in some specific cases.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-13 02:59:55 +09:00
parent 46be0b0dc8
commit 8541bdd858
2 changed files with 17 additions and 15 deletions

View File

@@ -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"