Skip to content

Commit e6b89c5

Browse files
jaypipesNicholas Thomson
authored andcommitted
prevent unused variable error (aws-controllers-k8s#101)
A [previous commit][0] that changed the ACK pkg/resource templates introduced an error for controllers that have CREATE or UPDATE implementations where the Output shape from the operation sets no fields on the CR. In these cases, attempting to build these controllers was resulting in a build failure, like this for the RDS controller: ``` pkg/resource/db_parameter_group/sdk.go:205:6: resp declared but not used ``` This corrects that by using a blanking technique immediately after the variable declaration: ``` var resp *SomeSDKShape; _ = resp; ``` [0]: a42b4a1 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 38e309d commit e6b89c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

templates/pkg/resource/sdk.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (rm *resourceManager) sdkCreate(
7070
{{ $hookCode }}
7171
{{- end }}
7272

73-
var resp {{ .CRD.GetOutputShapeGoType .CRD.Ops.Create }}
73+
var resp {{ .CRD.GetOutputShapeGoType .CRD.Ops.Create }}; _ = resp;
7474
resp, err = rm.sdkapi.{{ .CRD.Ops.Create.ExportedName }}WithContext(ctx, input)
7575
{{- if $hookCode := Hook .CRD "sdk_create_post_request" }}
7676
{{ $hookCode }}

templates/pkg/resource/sdk_update.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (rm *resourceManager) sdkUpdate(
2626
{{ $hookCode }}
2727
{{- end }}
2828

29-
var resp {{ .CRD.GetOutputShapeGoType .CRD.Ops.Update }}
29+
var resp {{ .CRD.GetOutputShapeGoType .CRD.Ops.Update }}; _ = resp;
3030
resp, err = rm.sdkapi.{{ .CRD.Ops.Update.ExportedName }}WithContext(ctx, input)
3131
{{- if $hookCode := Hook .CRD "sdk_update_post_request" }}
3232
{{ $hookCode }}

0 commit comments

Comments
 (0)