1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-11 10:00:38 +00:00

add golint check and fix all golints

This commit is contained in:
astaxie
2017-04-30 22:41:23 +08:00
parent ea3d0690cf
commit a91e2e9950
20 changed files with 271 additions and 175 deletions

View File

@ -507,10 +507,9 @@ func (d *dbBase) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Value, a
case DRPostgres:
if len(args) == 0 {
return 0, fmt.Errorf("`%s` use InsertOrUpdate must have a conflict column", a.DriverName)
} else {
args0 = strings.ToLower(args[0])
iouStr = fmt.Sprintf("ON CONFLICT (%s) DO UPDATE SET", args0)
}
args0 = strings.ToLower(args[0])
iouStr = fmt.Sprintf("ON CONFLICT (%s) DO UPDATE SET", args0)
default:
return 0, fmt.Errorf("`%s` nonsupport InsertOrUpdate in beego", a.DriverName)
}

View File

@ -250,7 +250,7 @@ func RegisterDriver(driverName string, typ DriverType) error {
drivers[driverName] = typ
} else {
if t != typ {
return fmt.Errorf("driverName `%s` db driver already registered and is other type\n", driverName)
return fmt.Errorf("driverName `%s` db driver already registered and is other type", driverName)
}
}
return nil
@ -261,7 +261,7 @@ func SetDataBaseTZ(aliasName string, tz *time.Location) error {
if al, ok := dataBaseCache.get(aliasName); ok {
al.TZ = tz
} else {
return fmt.Errorf("DataBase alias name `%s` not registered\n", aliasName)
return fmt.Errorf("DataBase alias name `%s` not registered", aliasName)
}
return nil
}
@ -296,5 +296,5 @@ func GetDB(aliasNames ...string) (*sql.DB, error) {
if ok {
return al.DB, nil
}
return nil, fmt.Errorf("DataBase of alias name `%s` not found\n", name)
return nil, fmt.Errorf("DataBase of alias name `%s` not found", name)
}