0

我陷入了这个比较:

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

这表明:

Sending: sms false string

这是Notification类型

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

这就是我创建notification结构的方式

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

notification.Type == "sms"我的问题是为什么false

4

0 回答 0