sdk-go
sdk-go copied to clipboard
Standardize on embedded structs or embedded interfaces
What would you like to be added:
Need to standardize on using embedded struct or embedded interface, with the latter preferred.
E.g. OperationState
embeds struct BaseState
instead of interface State
, whilst, EventBaseSwitchState.EventConditions
embeds interface EventCondition
instead of struct BaseEventCondition
.
Why is this needed:
With the various States - e.g. OperationState
has an embedded struct BaseState
. By doing so, these states do not implement the interface State
even though BaseState
does, i.e. OperationState
does not implement the interface State
, and this will disallow use of the more general / abstract State
interface as a pointer to actual concrete states. I believe the interface State
should have been used as the embedded property in the specific states
I might be missing something, but the intention was to have all the states implement the State
interface. If they are not it's a bug. Can you open a PR? Should be fairly simple to fix this.
Think will need to provide a custom unmarshal func
Let me know if you are ok sending a PR. Otherwise, I can get this one after the new year. :)
I think it's major rework as all (or almost all) states current embed the BaseState struct. Would rather leave such a big PR to you since I am still pretty unfamiliar with the code base
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.