In this code snippet, we are going to look at how you can compare two structs in Go to see if they are equal.
We’ll be creating a simple Developer struct which will feature a Name and Age field.
In the body of our main function, we’ll define two instances of this struct called elliot and elliot2 - not the most imaginative I know…
Below this, we’ll then use the reflect package from the Go standard library in order to perform a DeepEqual comparison.
Further Reading
If you found this code snippet useful, you may also be interested in some of the other content on the site: