@@ -1383,11 +1383,10 @@ func PopulateResourceFromAnnotation(
13831383 memberPath , _ := findFieldInCR (cfg , r , primaryField .Names .Original )
13841384 primaryKeyOut += requiredFieldGuardContructor ("primaryKey" , sourceVarName , primaryField .Names .CamelLower , indentLevel )
13851385 targetVarPath := fmt .Sprintf ("%s%s" , targetVarName , memberPath )
1386- primaryKeyOut += setResourceIdentifierPrimaryIdentifierAnn (cfg , r ,
1386+ primaryKeyOut += setResourceIdentifierPrimaryIdentifierAnn (
13871387 "&primaryKey" ,
13881388 primaryField ,
13891389 targetVarPath ,
1390- sourceVarName ,
13911390 indentLevel ,
13921391 )
13931392 } else {
@@ -1458,23 +1457,22 @@ func PopulateResourceFromAnnotation(
14581457 panic ("primary identifier '" + targetField .Path + "' must be a scalar type since NameOrID is a string" )
14591458 }
14601459
1461- targetVarPath := fmt .Sprintf ("%s%s" , targetVarName , memberPath )
1460+ sourceVarPath := fmt .Sprintf ("%s%s" , targetVarName , memberPath )
14621461 if inputShape .IsRequired (memberName ) || isPrimaryIdentifier {
14631462 requiredFieldVarName := fmt .Sprintf ("f%d" , memberIndex )
14641463 primaryKeyOut += requiredFieldGuardContructor (requiredFieldVarName , sourceVarName , targetField .Names .CamelLower , indentLevel )
1465- primaryKeyOut += setResourceIdentifierPrimaryIdentifierAnn (cfg , r ,
1464+ primaryKeyOut += setResourceIdentifierPrimaryIdentifierAnn (
14661465 fmt .Sprintf ("&%s" , requiredFieldVarName ),
14671466 targetField ,
1468- targetVarPath ,
1469- sourceVarName ,
1467+ sourceVarPath ,
14701468 indentLevel ,
14711469 )
14721470 } else {
14731471 additionalKeyOut += setResourceIdentifierAdditionalKeyAnn (
14741472 cfg , r ,
14751473 memberIndex ,
14761474 targetField ,
1477- targetVarPath ,
1475+ sourceVarPath ,
14781476 sourceVarName ,
14791477 names .New (fieldName ).CamelLower ,
14801478 indentLevel ,
@@ -1544,29 +1542,18 @@ func setResourceIdentifierPrimaryIdentifier(
15441542//
15451543// r.ko.Status.BrokerID = &identifier.NameOrID
15461544func setResourceIdentifierPrimaryIdentifierAnn (
1547- cfg * ackgenconfig.Config ,
1548- r * model.CRD ,
15491545 // The variable used for required key
15501546 requiredFieldVarName string ,
15511547 // The field that will be set on the target variable
15521548 targetField * model.Field ,
15531549 // The variable name that we want to set a value to
15541550 targetVarName string ,
1555- // The struct or struct field that we access our source value from
1556- sourceVarName string ,
15571551 // Number of levels of indentation to use
15581552 indentLevel int ,
15591553) string {
15601554 qualifiedTargetVar := fmt .Sprintf ("%s.%s" , targetVarName , targetField .Path )
1561-
1562- return setResourceForScalar (
1563- qualifiedTargetVar ,
1564- requiredFieldVarName ,
1565- targetField .ShapeRef ,
1566- indentLevel ,
1567- false ,
1568- false ,
1569- )
1555+ indent := strings .Repeat ("\t " , indentLevel )
1556+ return fmt .Sprintf ("%s%s = %s\n " , indent , qualifiedTargetVar , requiredFieldVarName )
15701557}
15711558
15721559// setResourceIdentifierAdditionalKey returns a string of Go code that sets a
0 commit comments