Commit 8825c71
committed
When generating sagemaker controller using
```
Building Kubernetes API objects for sagemaker
Generating deepcopy code for sagemaker
Generating custom resource definitions for sagemaker
Building service controller for sagemaker
Error: template: /home/amine/source/github.com/aws-controllers-k8s/code-generator/templates/pkg/resource/delta.go.tpl:21:3: executing "/home/amine/source/github.com/aws-controllers-k8s/code-generator/templates/pkg/resource/delta.go.tpl" at <GoCodeCompare .CRD "delta" "a.ko" "b.ko" 1>: error calling GoCodeCompare: strings: negative Repeat count
make: *** [Makefile:31: build-controller] Error 1
exit status 2
```
The reason behind this error was the `code.CompareResource` function that decreases `indentLevel` and added a closing bracket for a code that is not generated. The concerned block of code is `else if * != nil && * != nil {` statement generated when `nilCode` is not empty (see https://github.com/aws-controllers-k8s/code-generator/blob/99008660b665867ec69d7829be819411ee90b6cf/pkg/generate/code/compare.go#L109-L118)
To solve this problem we need to add closing bracket and decrease `indentLevel` only when `nilCode` is not empty.make build-controller SERVICE=sagemaker we can observe the following error:1 parent 7c0986e commit 8825c71
1 file changed
+15
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| |||
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
221 | | - | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| |||
431 | 432 | | |
432 | 433 | | |
433 | 434 | | |
| 435 | + | |
434 | 436 | | |
435 | 437 | | |
436 | 438 | | |
| |||
582 | 584 | | |
583 | 585 | | |
584 | 586 | | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
590 | 594 | | |
591 | 595 | | |
592 | 596 | | |
0 commit comments