errors.New(fmt.Sprintf(...)) -> fmt.Errorf(...)

This commit is contained in:
Sergey Kurt 2016-11-08 16:48:56 +03:00
parent 8872adf7ee
commit 07c9772d40
4 changed files with 4 additions and 9 deletions

View File

@ -5,7 +5,6 @@
package xorm
import (
"errors"
"fmt"
"strconv"
"strings"
@ -380,8 +379,7 @@ func (db *mssql) GetColumns(tableName string) ([]string, map[string]*core.Column
if _, ok := core.SqlTypes[ct]; ok {
col.SQLType = core.SQLType{Name: ct, DefaultLength: 0, DefaultLength2: 0}
} else {
return nil, nil, errors.New(fmt.Sprintf("unknow colType %v for %v - %v",
ct, tableName, col.Name))
return nil, nil, fmt.Errorf("Unknown colType %v for %v - %v", ct, tableName, col.Name)
}
}

View File

@ -6,7 +6,6 @@ package xorm
import (
"crypto/tls"
"errors"
"fmt"
"strconv"
"strings"
@ -375,7 +374,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
if _, ok := core.SqlTypes[colType]; ok {
col.SQLType = core.SQLType{Name: colType, DefaultLength: len1, DefaultLength2: len2}
} else {
return nil, nil, errors.New(fmt.Sprintf("unkonw colType %v", colType))
return nil, nil, fmt.Errorf("Unknown colType %v", colType)
}
if colKey == "PRI" {

View File

@ -5,7 +5,6 @@
package xorm
import (
"errors"
"fmt"
"strconv"
"strings"
@ -757,7 +756,7 @@ func (db *oracle) GetColumns(tableName string) ([]string, map[string]*core.Colum
}
if _, ok := core.SqlTypes[col.SQLType.Name]; !ok {
return nil, nil, errors.New(fmt.Sprintf("unkonw colType %v %v", *dataType, col.SQLType))
return nil, nil, fmt.Errorf("Unknown colType %v %v", *dataType, col.SQLType)
}
col.Length = dataLen

View File

@ -5,7 +5,6 @@
package xorm
import (
"errors"
"fmt"
"strconv"
"strings"
@ -990,7 +989,7 @@ WHERE c.relkind = 'r'::char AND c.relname = $1 AND s.table_schema = $2 AND f.att
col.SQLType = core.SQLType{Name: strings.ToUpper(dataType), DefaultLength: 0, DefaultLength2: 0}
}
if _, ok := core.SqlTypes[col.SQLType.Name]; !ok {
return nil, nil, errors.New(fmt.Sprintf("unknow colType: %v", dataType))
return nil, nil, fmt.Errorf("Unknown colType: %v", dataType)
}
col.Length = maxLen