If you need to check all the fields, just compare the structures:
type S struct { A int B float64 } func main() { fmt.Println(S{1, 3.14} == S{1, 3.14})
Note that if your structures contain pointers, this can become tricky, as they can point to two different but equal values. In this case, you can use reflect.DeepEqual :
type S2 struct { A int B *float64 } func main() { var f1, f2 = 3.14, 3.14
Playground: http://play.golang.org/p/G24DbRDQE8 .
Anything more interesting than this is likely to require you to define your own methods of equality.
source share