From e1129b8cc6e00967a698e9c1f3e16828bdec4baf Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 4 Jun 2024 11:10:11 -0700 Subject: [PATCH] Disallow unknown fields in soong variables file To catch issues earlier, like when renaming a field. Test: Presubmits Change-Id: Ie04507b54cc8de3efd27ee75ff32a85ea21b5750 --- android/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/android/config.go b/android/config.go index 5a6d40f31..a1127ad07 100644 --- a/android/config.go +++ b/android/config.go @@ -370,6 +370,7 @@ func loadFromConfigFile(configurable *ProductVariables, filename string) error { } else { // Make a decoder for it jsonDecoder := json.NewDecoder(configFileReader) + jsonDecoder.DisallowUnknownFields() err = jsonDecoder.Decode(configurable) if err != nil { return fmt.Errorf("config file: %s did not parse correctly: %s", filename, err.Error())