Like dyoo said, you can use nil
if your struct properties are pointers. If you want to keep them as strings you can compare with ""
. Here is a sample:
package main
import "fmt"
type MyStruct struct {
Property string
}
func main() {
s1 := MyStruct{
Property: "hey",
}
s2 := MyStruct{}
if s1.Property != "" {
fmt.Println("s1.Property has been set")
}
if s2.Property == "" {
fmt.Println("s2.Property has not been set")
}
}
http://play.golang.org/p/YStKFuekeZ