From 4e3f8c3a02474ef70e1f8c2bc893f6ff6462f4b5 Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Thu, 20 Jun 2024 20:26:03 +0000 Subject: [PATCH] Fix logs in reflect metadata library Signed-off-by: Anna Khmelnitsky --- nsxt/metadata/metadata.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nsxt/metadata/metadata.go b/nsxt/metadata/metadata.go index e910fe254..ae04fb500 100644 --- a/nsxt/metadata/metadata.go +++ b/nsxt/metadata/metadata.go @@ -155,9 +155,9 @@ func StructToSchema(elem reflect.Value, d *schema.ResourceData, metadata map[str if !elem.FieldByName(item.Metadata.SdkFieldName).IsValid() { // FieldByName can't find the field by name logger.Printf("[ERROR] %s skip key %s as %s not found in struct", - ctx, key, item.Metadata.SdkFieldName) + ctx, key, elem.Type()) err = fmt.Errorf("%s key %s not found in %s", - ctx, key, item.Metadata.SdkFieldName) + ctx, key, elem.Type()) return } if elem.FieldByName(item.Metadata.SdkFieldName).IsNil() { @@ -274,9 +274,9 @@ func SchemaToStruct(elem reflect.Value, d *schema.ResourceData, metadata map[str if !elem.FieldByName(item.Metadata.SdkFieldName).IsValid() { // FieldByName can't find the field by name logger.Printf("[WARN] %s skip key %s as %s not found in struct", - ctx, key, item.Metadata.SdkFieldName) + ctx, key, elem.Type()) err = fmt.Errorf("%s key %s not found in %s", - ctx, key, item.Metadata.SdkFieldName) + ctx, key, elem.Type()) return } @@ -680,7 +680,7 @@ func polyFlattenSchemaToStruct(ctx string, elem reflect.Value, key string, dataL } structElem := elem.FieldByName(item.Metadata.SdkFieldName) if !structElem.IsZero() { - err = fmt.Errorf("%s %s is alreay set", ctx, item.Metadata.SdkFieldName) + err = fmt.Errorf("%s %s is already set", ctx, item.Metadata.SdkFieldName) logger.Printf("[ERROR] %v", err) return }