From 25a69de8deb6f5b6c3145e696d31586b7b11fbab Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Thu, 9 Sep 2021 02:48:30 +0100 Subject: [PATCH] Improve the error when srcs field has the wrong type. In particular it's useful to print the module, since the panic is delayed from the init call. #codehealth Test: m nothing Change-Id: Ia91127be83d8a9ce08cf0c08bc3f13fce7be14af --- android/prebuilt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/prebuilt.go b/android/prebuilt.go index e61150243..e18989271 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -240,7 +240,7 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface value = value.Elem() } if value.Kind() != reflect.String { - panic(fmt.Errorf("prebuilt src field %q should be a string or a pointer to one but was %d %q", srcPropertyName, value.Kind(), value)) + panic(fmt.Errorf("prebuilt src field %q in %T in module %s should be a string or a pointer to one but was %v", srcField, srcProps, module, value)) } src := value.String() if src == "" {