1、项目实践中踩的坑
timeNow:=time.Now()//2020-04-26 19:33:25
timeStamp:="2020-04-26 19:32:25"
dataFormat:="2006-01-02 15:04:05"
tLast, _ := time.Parse(dataFormat, timeStamp)
res:=timeNow.Before(tLast)//返回的居然是true,一脸懵逼
var name, pwd string
//pwdRune := []rune(pwd)
length := len(pwd)
//length := len(pwdRune)
for i, v := range name {
if pwd[length-i-1] != v {
return false
}
}//切片越界
//syntax error: non-declaration statement outside function body
AlarmRecordCache, _ := cache.NewCache("memory", `{"interval":0}`)
//这样是可以的
var AlarmRecordCache, _ = cache.NewCache("memory", `{"interval":0}`)