Repository navigation
Conversation
|
@klihub @thaJeztah GitHub suggested you :-) Thoughts on this one? |
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
f8f62c2 to
9edc19f
Compare
| Quota: api.NewInt64(222), | ||
| Period: api.NewUInt64(333), | ||
| RealtimeRuntime: api.NewInt64(444), | ||
| RealtimePeriod: api.NewUInt64(555), |
There was a problem hiding this comment.
This is all a lot of boiler plating (both the old, and new situation); did a quick ask to my LLM;
Could we use protobuf's native optional scalar fields instead of custom wrapper types? Those would generate regular Go pointers, allowing us to use new(uint64, 111) (Go 1.26+) instead of api.NewUInt64(111), and potentially eliminate quite a bit of boilerplate. This would require a protobuf API change, though, so perhaps something to consider separately.
There was a problem hiding this comment.
I didn't look what would be involved to change it, but it was mostly my initial impression of "lots of boilerplating here!", but if it's possible somehow, could be worth investigating.
addresses the OptionalString FIXME
pkg/api/optional.goNew*constructors,*Ptrfrom-pointer constructors,Copy()methodspkg/api/deprecated_optional.goany-typed functions kept as deprecated wrapperspkg/api/adjustment.goNewInt64,NewUInt64,NewBool,NewString,NewRepeatedString,IntPtrpkg/api/update.gopkg/api/device.goFileModePtr,UInt32Ptrfor OCI spec pointer fieldspkg/api/hooks.goIntPtrfor OCI spec*intfieldpkg/api/resources.goInt64Ptr/UInt64Ptr/BoolPtrfor OCI spec pointers;.Copy()for copy pathspkg/api/optional_test.goNewRepeatedString,RepeatedStringPtr,Copy()pkg/adaptation/api.goString/Int64/… aliases replaced withNewString/StringPtr/NewInt64/Int64Ptr/…pkg/adaptation/result.goapi.NewInt64,api.NewUInt64,api.NewBool,api.NewString,api.NewRepeatedStringpkg/adaptation/adaptation_suite_test.gopkg/runtime-tools/generate/generate_suite_test.goplugins/device-injector/device-injector.goapi.NewFileMode(os.FileMode(...)),api.NewUInt32plugins/rdt/main_test.goapi.NewString,api.NewRepeatedString,api.NewBool