Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
danquack committed Dec 20, 2023
1 parent 6fc6446 commit 90e2860
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/service/batch/findv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func ListJobDefinitionsV2ByNameWithStatus(ctx context.Context, conn *batch.Clien
}

if out == nil || len(out) == 0 {

Check failure on line 49 in internal/service/batch/findv2.go

View workflow job for this annotation

GitHub Actions / 2 of 2

S1009: should omit nil check; len() for []github.com/aws/aws-sdk-go-v2/service/batch/types.JobDefinition is defined as zero (gosimple)
return nil, tfresource.NewEmptyResultError(input)
return out, tfresource.NewEmptyResultError(input)
}

return out, nil
Expand Down
19 changes: 15 additions & 4 deletions internal/service/batch/job_definition_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ func (d *dataSourceJobDefinition) Read(ctx context.Context, req datasource.ReadR
func frameworkFlattenEKSproperties(ctx context.Context, apiObject *batchtypes.EksProperties, data *dataSourceJobDefinitionData) (diags diag.Diagnostics) {
if apiObject == nil {
data.EksProperties = types.ObjectNull(eksPropertiesAttr)
return
return diags
}
props := map[string]attr.Value{
"dns_policy": flex.StringToFramework(ctx, apiObject.PodProperties.DnsPolicy),
Expand Down Expand Up @@ -1012,6 +1012,7 @@ func frameworkFlattenContainerProperties(ctx context.Context, c *batchtypes.Cont
}
volumes = append(volumes, types.ObjectValueMust(volumeAttr, volume))
}
containerProps["volumes"] = types.ListValueMust(types.ObjectType{AttrTypes: volumeAttr}, volumes)
} else {
containerProps["volumes"] = types.ListNull(types.ObjectType{AttrTypes: volumeAttr})
}
Expand Down Expand Up @@ -1070,7 +1071,7 @@ func frameworkFlattenRetryStrategy(ctx context.Context, jd *batchtypes.RetryStra
att["evaluate_on_exit"] = types.ListType{ElemType: types.ObjectType{AttrTypes: evaluateOnExitAttr}}
if jd == nil {
data.RetryStrategy = types.ObjectNull(att)
return
return diags
}

var elems []attr.Value
Expand All @@ -1081,7 +1082,12 @@ func frameworkFlattenRetryStrategy(ctx context.Context, jd *batchtypes.RetryStra
"on_reason": flex.StringToFramework(ctx, apiObject.OnReason),
"on_status_reason": flex.StringToFramework(ctx, apiObject.OnStatusReason),
}
elems = append(elems, types.ObjectValueMust(evaluateOnExitAttr, obj))
elem, d := types.ObjectValue(evaluateOnExitAttr, obj)
diags.Append(d...)
if diags.HasError() {
return diags
}
elems = append(elems, elem)
}

if elems == nil {
Expand All @@ -1090,9 +1096,14 @@ func frameworkFlattenRetryStrategy(ctx context.Context, jd *batchtypes.RetryStra
"evaluate_on_exit": types.ListNull(types.ObjectType{AttrTypes: evaluateOnExitAttr}),
})
} else {
eval, d := types.ListValue(types.ObjectType{AttrTypes: evaluateOnExitAttr}, elems)
diags.Append(d...)
if diags.HasError() {
return diags
}
data.RetryStrategy = types.ObjectValueMust(att, map[string]attr.Value{
"attempts": flex.Int32ToFramework(ctx, jd.Attempts),
"evaluate_on_exit": types.ListValueMust(types.ObjectType{AttrTypes: evaluateOnExitAttr}, elems),
"evaluate_on_exit": eval,
})
}
return diags
Expand Down

0 comments on commit 90e2860

Please sign in to comment.