diff --git a/wavesrv/pkg/scbus/modelupdate.go b/wavesrv/pkg/scbus/modelupdate.go index 0917f1aaf..7356d2d3c 100644 --- a/wavesrv/pkg/scbus/modelupdate.go +++ b/wavesrv/pkg/scbus/modelupdate.go @@ -126,4 +126,7 @@ type CleanableUpdateItem interface { func init() { // Register the model update packet type packet.RegisterPacketType(ModelUpdateStr, reflect.TypeOf(ModelUpdatePacketType{})) + + // Enforce the UpdatePacket interface + var _ UpdatePacket = (*ModelUpdatePacketType)(nil) } diff --git a/wavesrv/pkg/scbus/ptydataupdate.go b/wavesrv/pkg/scbus/ptydataupdate.go index 38449e9a1..4a7941d1f 100644 --- a/wavesrv/pkg/scbus/ptydataupdate.go +++ b/wavesrv/pkg/scbus/ptydataupdate.go @@ -47,4 +47,7 @@ func MakePtyDataUpdate(update *PtyDataUpdate) *PtyDataUpdatePacketType { func init() { // Register the PtyDataUpdatePacketType with the packet package packet.RegisterPacketType(PtyDataUpdateStr, reflect.TypeOf(PtyDataUpdatePacketType{})) + + // Enforce the UpdatePacket interface + var _ UpdatePacket = (*PtyDataUpdatePacketType)(nil) } diff --git a/wavesrv/pkg/scbus/scbus.go b/wavesrv/pkg/scbus/scbus.go index f9cefe298..aa219eb4a 100644 --- a/wavesrv/pkg/scbus/scbus.go +++ b/wavesrv/pkg/scbus/scbus.go @@ -67,6 +67,9 @@ type UpdatePacket interface { IsEmpty() bool } +// Enforce that UpdatePacket is a packet.PacketType +var _ packet.PacketType = (UpdatePacket)(nil) + // A channel for sending model updates to the client type UpdateChannel struct { ScreenId string @@ -89,6 +92,9 @@ func (sch *UpdateChannel) Match(screenId string) bool { return screenId == sch.ScreenId } +// Enforce that UpdateChannel is a Channel +var _ Channel[UpdatePacket] = (*UpdateChannel)(nil) + // A collection of channels that can transmit updates type UpdateBus struct { Bus[UpdatePacket] @@ -206,6 +212,9 @@ func (ch *RpcChannel) Match(string) bool { return true } +// Enforce that RpcChannel is a Channel +var _ Channel[RpcResponse] = (*RpcChannel)(nil) + // Send a user input request to the frontend and wait for a response func (bus *RpcBus) DoRpc(ctx context.Context, pk RpcPacket) (RpcResponse, error) { id := uuid.New().String() diff --git a/wavesrv/pkg/userinput/userinput.go b/wavesrv/pkg/userinput/userinput.go index 0ab0fe410..940fa974e 100644 --- a/wavesrv/pkg/userinput/userinput.go +++ b/wavesrv/pkg/userinput/userinput.go @@ -74,4 +74,8 @@ func GetUserInput(ctx context.Context, bus *scbus.RpcBus, userInputRequest *User func init() { // Register the user input request packet type packet.RegisterPacketType(UserInputResponsePacketStr, reflect.TypeOf(UserInputResponsePacketType{})) + + // Enforce the interfaces + var _ scbus.RpcResponse = (*UserInputResponsePacketType)(nil) + var _ scbus.RpcPacket = (*UserInputRequestType)(nil) }