var para1 struct { email, addr string }
After this line, para1 is a structure value containing two empty lines as you can see here .
only fragments, maps, channels, pointers and functions can be nil . Therefore, comparing para1 with nil does not make sense, and the compiler complains about it.
Admittedly, the error message might be better.
If you want to know if para1 empty, you must specify its name and declare a method on it:
type Parameter struct { email, addr string } func (p Parameter) Empty() bool { return (p.email != "" && p.addr != "") }
source share