From a5627b9a4c7eb1647237b8306a31bf5cae922e94 Mon Sep 17 00:00:00 2001 From: Daithi Hearn Date: Sun, 28 Jan 2024 20:53:05 +0100 Subject: [PATCH 1/2] fix: excluding fields from returned json --- pkg/game/game.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/game/game.go b/pkg/game/game.go index 258c917..b7acd77 100644 --- a/pkg/game/game.go +++ b/pkg/game/game.go @@ -75,9 +75,9 @@ type Game struct { Name string `bson:"name" json:"name"` Status Status `bson:"status" json:"status"` Players []Player `bson:"players" json:"players"` - Dummy []CardName `bson:"dummy" json:"dummy"` - CurrentRound Round `bson:"currentRound" json:"currentRound"` - Completed []Round `bson:"completedRounds" json:"completedRounds"` + Dummy []CardName `bson:"dummy" json:"-"` + CurrentRound Round `bson:"currentRound" json:"-"` + Completed []Round `bson:"completedRounds" json:"-"` Deck []CardName `bson:"deck" json:"-"` } From 90975890bbe2e05e62fd44b7f87b3fe2f0b190a8 Mon Sep 17 00:00:00 2001 From: Daithi Hearn Date: Sun, 28 Jan 2024 20:53:23 +0100 Subject: [PATCH 2/2] fix: ensuring array is never null --- pkg/game/game-methods.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/game/game-methods.go b/pkg/game/game-methods.go index 32b13e8..a92fc1d 100644 --- a/pkg/game/game-methods.go +++ b/pkg/game/game-methods.go @@ -555,7 +555,7 @@ func (g *Game) Play(id string, card CardName) error { } // Remove the card from the player's hand - var cards []CardName + cards := make([]CardName, 0) for _, c := range state.Cards { if c != card { cards = append(cards, c)