How to check for an empty struct?
You can use == to compare with a zero value composite literal because all fields in Session are comparable: if (Session{}) == session { fmt.Println(“is zero value”) } playground example Because of a parsing ambiguity, parentheses are required around the composite literal in the if condition. The use of == above applies to structs where … Read more