Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong. A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.
Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
diff --git a/android/api_levels.go b/android/api_levels.go
index 1b56625..51d4703 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -51,8 +51,10 @@
return PathForOutput(ctx, "api_levels.json")
}
+var apiLevelsMapKey = NewOnceKey("ApiLevelsMap")
+
func getApiLevelsMap(config Config) map[string]int {
- return config.Once("ApiLevelsMap", func() interface{} {
+ return config.Once(apiLevelsMapKey, func() interface{} {
baseApiLevel := 9000
apiLevelsMap := map[string]int{
"G": 9,