golang: invalid operation: someVar == "" (mismatched types *string and string)
14 Jul 2014 in TIL
I was trying to see if a value was empty in a golang script I was writing, when I came across an odd error message:
It turns out that the following code doesn't return a simple string, but an instance of flag.String
go
To perform the comparison, you need to use a pointer to it as follows:
go