Add support to detect ARM variant on Windows
ARM variant detection logic was authored originally with POSIX OS in mind. This change leaves POSIX code path unaltered and adds support to detect ARM variant on Windows by leveraging runtime.goarch. Signed-off-by: Jiri Appl <jiria@microsoft.com>
This commit is contained in:
parent
ac01f20a8e
commit
e6529f4ebc
@ -74,6 +74,22 @@ func getCPUInfo(pattern string) (info string, err error) {
|
||||
}
|
||||
|
||||
func getCPUVariant() string {
|
||||
if runtime.GOOS == "windows" {
|
||||
// Windows only supports v7 for ARM32 and v8 for ARM64 and so we can use
|
||||
// runtime.GOARCH to determine the variants
|
||||
var variant string
|
||||
switch runtime.GOARCH {
|
||||
case "arm64":
|
||||
variant = "v8"
|
||||
case "arm":
|
||||
variant = "v7"
|
||||
default:
|
||||
variant = "unknown"
|
||||
}
|
||||
|
||||
return variant
|
||||
}
|
||||
|
||||
variant, err := getCPUInfo("Cpu architecture")
|
||||
if err != nil {
|
||||
log.L.WithError(err).Error("failure getting variant")
|
||||
|
Loading…
Reference in New Issue
Block a user