Skip to content

Commit f7f07fd

Browse files
committed
address k8s.io/apimachinery/pkg/apis/meta/v1.Time struct literal uses unkeyed fields warnings
1 parent 016d4c5 commit f7f07fd

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

pkg/generate/code/set_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,7 @@ func setResourceForScalar(
22062206
setTo := sourceVar
22072207
shape := shapeRef.Shape
22082208
if shape.Type == "timestamp" {
2209-
setTo = "&metav1.Time{*" + sourceVar + "}"
2209+
setTo = "&metav1.Time{Time: *" + sourceVar + "}"
22102210
}
22112211

22122212
targetVar = strings.TrimPrefix(targetVar, ".")

pkg/generate/code/set_resource_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ func TestSetResource_APIGWv2_Route_ReadOne(t *testing.T) {
204204
)
205205
}
206206

207-
208207
func TestSetResource_SageMaker_Domain_ReadOne(t *testing.T) {
209208
assert := assert.New(t)
210209
require := require.New(t)
@@ -617,12 +616,12 @@ func TestSetResource_DynamoDB_Backup_ReadOne(t *testing.T) {
617616
ko.Status.ACKResourceMetadata.ARN = &arn
618617
}
619618
if resp.BackupDescription.BackupDetails.BackupCreationDateTime != nil {
620-
ko.Status.BackupCreationDateTime = &metav1.Time{*resp.BackupDescription.BackupDetails.BackupCreationDateTime}
619+
ko.Status.BackupCreationDateTime = &metav1.Time{Time: *resp.BackupDescription.BackupDetails.BackupCreationDateTime}
621620
} else {
622621
ko.Status.BackupCreationDateTime = nil
623622
}
624623
if resp.BackupDescription.BackupDetails.BackupExpiryDateTime != nil {
625-
ko.Status.BackupExpiryDateTime = &metav1.Time{*resp.BackupDescription.BackupDetails.BackupExpiryDateTime}
624+
ko.Status.BackupExpiryDateTime = &metav1.Time{Time: *resp.BackupDescription.BackupDetails.BackupExpiryDateTime}
626625
} else {
627626
ko.Status.BackupExpiryDateTime = nil
628627
}
@@ -709,7 +708,7 @@ func TestSetResource_DynamoDB_Table_ReadOne(t *testing.T) {
709708
f0.ArchivalBackupARN = resp.Table.ArchivalSummary.ArchivalBackupArn
710709
}
711710
if resp.Table.ArchivalSummary.ArchivalDateTime != nil {
712-
f0.ArchivalDateTime = &metav1.Time{*resp.Table.ArchivalSummary.ArchivalDateTime}
711+
f0.ArchivalDateTime = &metav1.Time{Time: *resp.Table.ArchivalSummary.ArchivalDateTime}
713712
}
714713
if resp.Table.ArchivalSummary.ArchivalReason != nil {
715714
f0.ArchivalReason = resp.Table.ArchivalSummary.ArchivalReason
@@ -740,14 +739,14 @@ func TestSetResource_DynamoDB_Table_ReadOne(t *testing.T) {
740739
f2.BillingMode = aws.String(string(resp.Table.BillingModeSummary.BillingMode))
741740
}
742741
if resp.Table.BillingModeSummary.LastUpdateToPayPerRequestDateTime != nil {
743-
f2.LastUpdateToPayPerRequestDateTime = &metav1.Time{*resp.Table.BillingModeSummary.LastUpdateToPayPerRequestDateTime}
742+
f2.LastUpdateToPayPerRequestDateTime = &metav1.Time{Time: *resp.Table.BillingModeSummary.LastUpdateToPayPerRequestDateTime}
744743
}
745744
ko.Status.BillingModeSummary = f2
746745
} else {
747746
ko.Status.BillingModeSummary = nil
748747
}
749748
if resp.Table.CreationDateTime != nil {
750-
ko.Status.CreationDateTime = &metav1.Time{*resp.Table.CreationDateTime}
749+
ko.Status.CreationDateTime = &metav1.Time{Time: *resp.Table.CreationDateTime}
751750
} else {
752751
ko.Status.CreationDateTime = nil
753752
}
@@ -936,7 +935,7 @@ func TestSetResource_DynamoDB_Table_ReadOne(t *testing.T) {
936935
if resp.Table.RestoreSummary != nil {
937936
f13 := &svcapitypes.RestoreSummary{}
938937
if resp.Table.RestoreSummary.RestoreDateTime != nil {
939-
f13.RestoreDateTime = &metav1.Time{*resp.Table.RestoreSummary.RestoreDateTime}
938+
f13.RestoreDateTime = &metav1.Time{Time: *resp.Table.RestoreSummary.RestoreDateTime}
940939
}
941940
if resp.Table.RestoreSummary.RestoreInProgress != nil {
942941
f13.RestoreInProgress = resp.Table.RestoreSummary.RestoreInProgress
@@ -954,7 +953,7 @@ func TestSetResource_DynamoDB_Table_ReadOne(t *testing.T) {
954953
if resp.Table.SSEDescription != nil {
955954
f14 := &svcapitypes.SSEDescription{}
956955
if resp.Table.SSEDescription.InaccessibleEncryptionDateTime != nil {
957-
f14.InaccessibleEncryptionDateTime = &metav1.Time{*resp.Table.SSEDescription.InaccessibleEncryptionDateTime}
956+
f14.InaccessibleEncryptionDateTime = &metav1.Time{Time: *resp.Table.SSEDescription.InaccessibleEncryptionDateTime}
958957
}
959958
if resp.Table.SSEDescription.KMSMasterKeyArn != nil {
960959
f14.KMSMasterKeyARN = resp.Table.SSEDescription.KMSMasterKeyArn
@@ -1029,7 +1028,7 @@ func TestSetResource_EC2_LaunchTemplate_Create(t *testing.T) {
10291028
// "LaunchTemplate" that contains the CreatedBy field.
10301029
expected := `
10311030
if resp.LaunchTemplate.CreateTime != nil {
1032-
ko.Status.CreateTime = &metav1.Time{*resp.LaunchTemplate.CreateTime}
1031+
ko.Status.CreateTime = &metav1.Time{Time: *resp.LaunchTemplate.CreateTime}
10331032
} else {
10341033
ko.Status.CreateTime = nil
10351034
}
@@ -1095,7 +1094,7 @@ func TestSetResource_ECR_Repository_Create(t *testing.T) {
10951094
// "Repository" that contains the RegistryId field.
10961095
expected := `
10971096
if resp.Repository.CreatedAt != nil {
1098-
ko.Status.CreatedAt = &metav1.Time{*resp.Repository.CreatedAt}
1097+
ko.Status.CreatedAt = &metav1.Time{Time: *resp.Repository.CreatedAt}
10991098
} else {
11001099
ko.Status.CreatedAt = nil
11011100
}
@@ -1158,7 +1157,7 @@ func TestSetResource_ECR_Repository_ReadMany(t *testing.T) {
11581157
found := false
11591158
for _, elem := range resp.Repositories {
11601159
if elem.CreatedAt != nil {
1161-
ko.Status.CreatedAt = &metav1.Time{*elem.CreatedAt}
1160+
ko.Status.CreatedAt = &metav1.Time{Time: *elem.CreatedAt}
11621161
} else {
11631162
ko.Status.CreatedAt = nil
11641163
}
@@ -1895,7 +1894,7 @@ func TestSetResource_IAM_Role_NestedSetConfig(t *testing.T) {
18951894
ko.Spec.AssumeRolePolicyDocument = nil
18961895
}
18971896
if resp.Role.CreateDate != nil {
1898-
ko.Status.CreateDate = &metav1.Time{*resp.Role.CreateDate}
1897+
ko.Status.CreateDate = &metav1.Time{Time: *resp.Role.CreateDate}
18991898
} else {
19001899
ko.Status.CreateDate = nil
19011900
}
@@ -1928,7 +1927,7 @@ func TestSetResource_IAM_Role_NestedSetConfig(t *testing.T) {
19281927
if resp.Role.RoleLastUsed != nil {
19291928
f8 := &svcapitypes.RoleLastUsed{}
19301929
if resp.Role.RoleLastUsed.LastUsedDate != nil {
1931-
f8.LastUsedDate = &metav1.Time{*resp.Role.RoleLastUsed.LastUsedDate}
1930+
f8.LastUsedDate = &metav1.Time{Time: *resp.Role.RoleLastUsed.LastUsedDate}
19321931
}
19331932
if resp.Role.RoleLastUsed.Region != nil {
19341933
f8.Region = resp.Role.RoleLastUsed.Region
@@ -2168,7 +2167,7 @@ func TestSetResource_EC2_Instance_Create(t *testing.T) {
21682167
f9elem.ElasticInferenceAcceleratorAssociationState = f9iter.ElasticInferenceAcceleratorAssociationState
21692168
}
21702169
if f9iter.ElasticInferenceAcceleratorAssociationTime != nil {
2171-
f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f9iter.ElasticInferenceAcceleratorAssociationTime}
2170+
f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{Time: *f9iter.ElasticInferenceAcceleratorAssociationTime}
21722171
}
21732172
f9 = append(f9, f9elem)
21742173
}
@@ -2244,7 +2243,7 @@ func TestSetResource_EC2_Instance_Create(t *testing.T) {
22442243
ko.Spec.KeyName = nil
22452244
}
22462245
if elem.LaunchTime != nil {
2247-
ko.Status.LaunchTime = &metav1.Time{*elem.LaunchTime}
2246+
ko.Status.LaunchTime = &metav1.Time{Time: *elem.LaunchTime}
22482247
} else {
22492248
ko.Status.LaunchTime = nil
22502249
}
@@ -2538,7 +2537,7 @@ func TestSetResource_EC2_Instance_Create(t *testing.T) {
25382537
ko.Status.UsageOperation = nil
25392538
}
25402539
if elem.UsageOperationUpdateTime != nil {
2541-
ko.Status.UsageOperationUpdateTime = &metav1.Time{*elem.UsageOperationUpdateTime}
2540+
ko.Status.UsageOperationUpdateTime = &metav1.Time{Time: *elem.UsageOperationUpdateTime}
25422541
} else {
25432542
ko.Status.UsageOperationUpdateTime = nil
25442543
}
@@ -2697,7 +2696,7 @@ func TestSetResource_EC2_Instance_ReadMany(t *testing.T) {
26972696
f9elem.ElasticInferenceAcceleratorAssociationState = f9iter.ElasticInferenceAcceleratorAssociationState
26982697
}
26992698
if f9iter.ElasticInferenceAcceleratorAssociationTime != nil {
2700-
f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f9iter.ElasticInferenceAcceleratorAssociationTime}
2699+
f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{Time: *f9iter.ElasticInferenceAcceleratorAssociationTime}
27012700
}
27022701
f9 = append(f9, f9elem)
27032702
}
@@ -2773,7 +2772,7 @@ func TestSetResource_EC2_Instance_ReadMany(t *testing.T) {
27732772
ko.Spec.KeyName = nil
27742773
}
27752774
if elem.LaunchTime != nil {
2776-
ko.Status.LaunchTime = &metav1.Time{*elem.LaunchTime}
2775+
ko.Status.LaunchTime = &metav1.Time{Time: *elem.LaunchTime}
27772776
} else {
27782777
ko.Status.LaunchTime = nil
27792778
}
@@ -3067,7 +3066,7 @@ func TestSetResource_EC2_Instance_ReadMany(t *testing.T) {
30673066
ko.Status.UsageOperation = nil
30683067
}
30693068
if elem.UsageOperationUpdateTime != nil {
3070-
ko.Status.UsageOperationUpdateTime = &metav1.Time{*elem.UsageOperationUpdateTime}
3069+
ko.Status.UsageOperationUpdateTime = &metav1.Time{Time: *elem.UsageOperationUpdateTime}
30713070
} else {
30723071
ko.Status.UsageOperationUpdateTime = nil
30733072
}

0 commit comments

Comments
 (0)