~edwargix/tallyard

a87dc50873517fa0023c488827000d183462dd64 — David Florness 4 years ago 1b0c028
Fix Election JSON marshalling

This prevents an infinite loop.
1 files changed, 4 insertions(+), 1 deletions(-)

M election/election.go
M election/election.go => election/election.go +4 -1
@@ 39,7 39,10 @@ func NewElection(candidates []Candidate, createEventId id.EventID,
}

func (el *Election) UnmarshalJSON(b []byte) error {
	err := json.Unmarshal(b, &el)
	type Alias Election // create alias to prevent endless loop
	tmp := (*Alias)(el)

	err := json.Unmarshal(b, tmp)
	if err != nil {
		return err
	}