string and redis.String (redigo) type does not match in golang

156 Views Asked by At

I got stuck on this comparision:

fmt.Println("Sending: ", notification.Type, notification.Type == "sms", reflect.TypeOf(notification.Type))

this out puts as:

Sending: sms false string

This is the Notificationtype

type Notification struct {
    Done    bool   `redis:"done"`
    Message string `redis:"message"`
    Type    string `redis:"type"`
    ID      string `redis:"id"`
    Error   error
}

And this is how I create the notification struct

notification := &Notification{ID: notificationID}
notification.Type, err = redis.String(c.Do("GET", "notification:id:"+notification.ID+":type"))

My question is why notification.Type == "sms" is false

0

There are 0 best solutions below