func (g *Game) handleMessageHelper(ctx context.Context, m message.Message, send messageSender, active *bool, messageHandlers map[message.Type]messageHandler) error {
	handler, handlerExists := messageHandlers[m.Type]
	if !handlerExists {
		return fmt.Errorf("game does not know how to handle MessageType %v", m.Type)
	}
	_, playerInGame := g.players[m.PlayerName]
	if !playerInGame && m.Type != message.JoinGame {
		return fmt.Errorf("game does not have player named '%v'", m.PlayerName)
	}
	*active = true
	return handler(ctx, m, send)
}
// handleMessageHelper clearly handles the message, after checking the a handler exists and the player for the message is in the game.
handleMessageHelper clearly handles the message, after checking the a handler exists and the player for the message is in the game.
// handleMessageHelper clearly handles the message after checking the a handler exists and the player for the message is in the game .
func (g *Game) handleMessageHelper(ctx context.Context, m message.Message, send messageSender, active *bool, messageHandlers map[message.Type]messageHandler) error {
	handler, handlerExists := messageHandlers[m.Type]
	if !handlerExists {
		return fmt.Errorf("game does not know how to handle MessageType %v", m.Type)
	}
	_, playerInGame := g.players[m.PlayerName]
	if !playerInGame && m.Type != message.JoinGame {
		return fmt.Errorf("game does not have player named '%v'", m.PlayerName)
	}
	*active = true
	return handler(ctx, m, send)
}
func ( g * Game ) handleMessageHelper ( ctx context . Context , m message . Message , send messageSender , active * bool , messageHandlers map [ message . Type ] messageHandler ) error { handler , handlerExists := messageHandlers [ m . Type ] if ! handlerExists { return fmt . Errorf ( " " , m . Type ) } _ , playerInGame := g . players [ m . PlayerName ] if ! playerInGame && m . Type != message . JoinGame { return fmt . Errorf ( " " , m . PlayerName ) } * active = true return handler ( ctx , m , send ) }
handleMessageHelper clearly handles the message, after checking the a handler exists and the player for the message is in the game.
handleMessageHelper clearly handles the message after checking the a handler exists and the player for the message is in the game .