Merge pull request #486 from nemec784/fix/warnings/errorf

golint: replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
This commit is contained in:
Lunny Xiao 2016-11-09 09:20:57 +08:00 committed by GitHub
commit d879184ec4
4 changed files with 4 additions and 9 deletions

View File

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

View File

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

View File

@ -5,7 +5,6 @@
package xorm package xorm
import ( import (
"errors"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -757,7 +756,7 @@ func (db *oracle) GetColumns(tableName string) ([]string, map[string]*core.Colum
} }
if _, ok := core.SqlTypes[col.SQLType.Name]; !ok { 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 col.Length = dataLen

View File

@ -5,7 +5,6 @@
package xorm package xorm
import ( import (
"errors"
"fmt" "fmt"
"strconv" "strconv"
"strings" "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} col.SQLType = core.SQLType{Name: strings.ToUpper(dataType), DefaultLength: 0, DefaultLength2: 0}
} }
if _, ok := core.SqlTypes[col.SQLType.Name]; !ok { 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 col.Length = maxLen