Golang把时间和数字相乘报错invalid operation: second * time.Second (mismatched types int and time.Duration)
在设置cookie过期时间的时候,用当日剩余秒数与内置变量相乘报错invalid operation: second * time.Second (mismatched types int and time.Duration)
Expires : time.Now().Add(10 * time.Second),//正常数字相乘没错 Expire:=12345 Expires : time.Now().Add(Expire * time.Second), //表达式相乘报错 Expire:=12345 Expires : time.Now().Add(time.Duration(Expire) * time.Second), //这样写就对了