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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user