Skip unmarshaled fields with generating compatibility fixtures

This commit is contained in:
Jordan Liggitt 2023-02-21 12:54:40 -05:00
parent 5f9a042284
commit 688f5babba
No known key found for this signature in database

View File

@ -133,6 +133,10 @@ func fill(dataString string, dataInt int, t reflect.Type, v reflect.Value, fillF
// use the json field name, which must be stable
dataString := strings.Split(field.Tag.Get("json"), ",")[0]
if dataString == "-" {
// unserialized field, no need to fill it
continue
}
if len(dataString) == 0 {
// fall back to the struct field name if there is no json field name
dataString = "<no json tag> " + field.Name