Use ArchType instead of string as map key
There is no need to convert ArchType to a string, it can be used
as a map key directly. It will also be implicity stringified when
passed as a %q parameter to fmt.Errorf.
Test: builds
Change-Id: I5c316fb543108cb88c0c9c1ebafc1bf0050d143e
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 8f424d8..d769fea 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -116,19 +116,18 @@
}
minVersion := 9 // Minimum version supported by the NDK.
- firstArchVersions := map[string]int{
- "arm": 9,
- "arm64": 21,
- "mips": 9,
- "mips64": 21,
- "x86": 9,
- "x86_64": 21,
+ firstArchVersions := map[android.ArchType]int{
+ android.Arm: 9,
+ android.Arm64: 21,
+ android.Mips: 9,
+ android.Mips64: 21,
+ android.X86: 9,
+ android.X86_64: 21,
}
- archStr := arch.ArchType.String()
- firstArchVersion, ok := firstArchVersions[archStr]
+ firstArchVersion, ok := firstArchVersions[arch.ArchType]
if !ok {
- panic(fmt.Errorf("Arch %q not found in firstArchVersions", archStr))
+ panic(fmt.Errorf("Arch %q not found in firstArchVersions", arch.ArchType))
}
if apiLevel == "minimum" {