From 688f5babba4f4ea030fdb949ef14da3cb40d9b1d Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 21 Feb 2023 12:54:40 -0500 Subject: [PATCH] Skip unmarshaled fields with generating compatibility fixtures --- .../apimachinery/pkg/api/apitesting/roundtrip/construct.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go index ea18af12730..705839f54d3 100644 --- a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/construct.go @@ -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 = " " + field.Name