Add a comment explaining what this function does and where the values
come from.
If the architecture isn't know, instead of returning an empty string
which could fail mysteriously, raise a KeyError so it fails quickly.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
import re
def map_arch(a):
+ """
+ Map our architecture names to Go's GOARCH names.
+ See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go for the complete list.
+ """
if re.match('i.86', a):
return '386'
elif a == 'x86_64':
return 'riscv64'
elif a == 'loongarch64':
return 'loong64'
- return ''
+ raise KeyError(f"Cannot map architecture {a}")