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
This commit is contained in:
Martin Stjernholm
2021-09-09 02:48:30 +01:00
parent 7bb0238418
commit 25a69de8de

View File

@@ -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 == "" {