Skip to content

Commit e6529f4

Browse files
committed
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 <[email protected]>
1 parent ac01f20 commit e6529f4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

platforms/cpuinfo.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ func getCPUInfo(pattern string) (info string, err error) {
7474
}
7575

7676
func getCPUVariant() string {
77+
if runtime.GOOS == "windows" {
78+
// Windows only supports v7 for ARM32 and v8 for ARM64 and so we can use
79+
// runtime.GOARCH to determine the variants
80+
var variant string
81+
switch runtime.GOARCH {
82+
case "arm64":
83+
variant = "v8"
84+
case "arm":
85+
variant = "v7"
86+
default:
87+
variant = "unknown"
88+
}
89+
90+
return variant
91+
}
92+
7793
variant, err := getCPUInfo("Cpu architecture")
7894
if err != nil {
7995
log.L.WithError(err).Error("failure getting variant")

0 commit comments

Comments
 (0)