#396·decimal

Question: Make assertions on structs having Decimal as field on libraries like gomock?

Author: denizgursoyCreated Feb 14, 2025Updated Feb 14, 2025

Hello, I use gomock and I make some assertions on a struct that has decimal fields.

type MyType struct {
		Field1 string
		Decimal decimal.Decimal
	}

Assertions on a type like this always fail in gomock probably because of exp or precisson. Is there an already solution? My solution was to marshal to JSON and compare

Thanks