Commit a9e2cea
authored
Handle double and long shape types in setSDKForScalar for list members (#683)
## Fix: handle `double` and `long` shape types in `setSDKForScalar` for list members
### Issue
The QuickSight controller analysis resource fails to compile with errors like:
```
pkg/resource/analysis/sdk.go:6223:30: cannot use f2f6elemf1f0f1iter
(variable of type *float64) as float64 value in assignment
```
This affects all `[]float64` list fields in the CRD-to-SDK conversion path, producing 10+ compile errors across the Analysis resource's `sdk.go`.
### Root Cause
`setSDKForScalar` in `pkg/generate/code/set_sdk.go` has an `intOrFloat` map that handles narrowing conversions for `"integer"` (int64→int32) and `"float"` (float64→float32) shape types. These types need range checks and casts because the CRD uses 64-bit types while the SDK uses 32-bit types.
However, `"double"` (float64) and `"long"` (int64) shape types were not handled. When these appear as list members:
- CRD type: `[]*float64` — loop iterator is `*float64`
- SDK type: `[]float64` — target element is `float64`
The code fell through to the default `else` branch which strips the `*` dereference via `strings.TrimPrefix(setTo, "*")`, generating `elem = iter` instead of `elem = *iter`.
### Fix
Added an explicit branch for `"double"` and `"long"` types in `setSDKForScalar`. Unlike `"integer"`/`"float"`, these are already native 64-bit Go types, so no range check or narrowing cast is needed — just correct pointer dereference in list context.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent f0b0805 commit a9e2cea
5 files changed
Lines changed: 22720 additions & 0 deletions
File tree
- pkg
- generate/code
- testdata
- codegen/sdk-codegen/aws-models
- models/apis/quicksight/0000-00-00
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1765 | 1765 | | |
1766 | 1766 | | |
1767 | 1767 | | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
1768 | 1778 | | |
1769 | 1779 | | |
1770 | 1780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6656 | 6656 | | |
6657 | 6657 | | |
6658 | 6658 | | |
| 6659 | + | |
| 6660 | + | |
| 6661 | + | |
| 6662 | + | |
| 6663 | + | |
| 6664 | + | |
| 6665 | + | |
| 6666 | + | |
| 6667 | + | |
| 6668 | + | |
| 6669 | + | |
| 6670 | + | |
| 6671 | + | |
| 6672 | + | |
| 6673 | + | |
| 6674 | + | |
| 6675 | + | |
| 6676 | + | |
| 6677 | + | |
| 6678 | + | |
| 6679 | + | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + | |
| 6683 | + | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
| 6694 | + | |
| 6695 | + | |
| 6696 | + | |
| 6697 | + | |
| 6698 | + | |
| 6699 | + | |
| 6700 | + | |
| 6701 | + | |
| 6702 | + | |
| 6703 | + | |
| 6704 | + | |
| 6705 | + | |
| 6706 | + | |
| 6707 | + | |
| 6708 | + | |
| 6709 | + | |
| 6710 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
118 | 182 | | |
119 | 183 | | |
120 | 184 | | |
| |||
0 commit comments