Fix golint 'should omit (type|2nd value) ...' warnings
This commit is contained in:
parent
80c3483048
commit
227b82da41
|
@ -24,7 +24,7 @@ func mysqlEngine() (*xorm.Engine, error) {
|
||||||
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
||||||
}
|
}
|
||||||
|
|
||||||
var u *User = &User{}
|
var u = &User{}
|
||||||
|
|
||||||
func test(engine *xorm.Engine) {
|
func test(engine *xorm.Engine) {
|
||||||
err := engine.CreateTables(u)
|
err := engine.CreateTables(u)
|
||||||
|
|
|
@ -15,10 +15,10 @@ type Status struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Registed Status = Status{"Registed", "white"}
|
Registed = Status{"Registed", "white"}
|
||||||
Approved Status = Status{"Approved", "green"}
|
Approved = Status{"Approved", "green"}
|
||||||
Removed Status = Status{"Removed", "red"}
|
Removed = Status{"Removed", "red"}
|
||||||
Statuses map[string]Status = map[string]Status{
|
Statuses = map[string]Status{
|
||||||
Registed.Name: Registed,
|
Registed.Name: Registed,
|
||||||
Approved.Name: Approved,
|
Approved.Name: Approved,
|
||||||
Removed.Name: Removed,
|
Removed.Name: Removed,
|
||||||
|
|
|
@ -24,7 +24,7 @@ func mysqlEngine() (*xorm.Engine, error) {
|
||||||
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
||||||
}
|
}
|
||||||
|
|
||||||
var u *User = &User{}
|
var u = &User{}
|
||||||
|
|
||||||
func test(engine *xorm.Engine) {
|
func test(engine *xorm.Engine) {
|
||||||
err := engine.CreateTables(u)
|
err := engine.CreateTables(u)
|
||||||
|
|
|
@ -24,7 +24,7 @@ func mysqlEngine() (*xorm.Engine, error) {
|
||||||
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
|
||||||
}
|
}
|
||||||
|
|
||||||
var u *User = &User{}
|
var u = &User{}
|
||||||
|
|
||||||
func test(engine *xorm.Engine) {
|
func test(engine *xorm.Engine) {
|
||||||
err := engine.CreateTables(u)
|
err := engine.CreateTables(u)
|
||||||
|
|
|
@ -257,8 +257,9 @@ func (db *mssql) SqlType(c *core.Column) string {
|
||||||
return core.Int
|
return core.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasLen1 bool = (c.Length > 0)
|
hasLen1 := (c.Length > 0)
|
||||||
var hasLen2 bool = (c.Length2 > 0)
|
hasLen2 := (c.Length2 > 0)
|
||||||
|
|
||||||
if hasLen2 {
|
if hasLen2 {
|
||||||
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
||||||
} else if hasLen1 {
|
} else if hasLen1 {
|
||||||
|
|
|
@ -201,7 +201,7 @@ func (db *mysql) SqlType(c *core.Column) string {
|
||||||
res = core.Enum
|
res = core.Enum
|
||||||
res += "("
|
res += "("
|
||||||
opts := ""
|
opts := ""
|
||||||
for v, _ := range c.EnumOptions {
|
for v := range c.EnumOptions {
|
||||||
opts += fmt.Sprintf(",'%v'", v)
|
opts += fmt.Sprintf(",'%v'", v)
|
||||||
}
|
}
|
||||||
res += strings.TrimLeft(opts, ",")
|
res += strings.TrimLeft(opts, ",")
|
||||||
|
@ -210,7 +210,7 @@ func (db *mysql) SqlType(c *core.Column) string {
|
||||||
res = core.Set
|
res = core.Set
|
||||||
res += "("
|
res += "("
|
||||||
opts := ""
|
opts := ""
|
||||||
for v, _ := range c.SetOptions {
|
for v := range c.SetOptions {
|
||||||
opts += fmt.Sprintf(",'%v'", v)
|
opts += fmt.Sprintf(",'%v'", v)
|
||||||
}
|
}
|
||||||
res += strings.TrimLeft(opts, ",")
|
res += strings.TrimLeft(opts, ",")
|
||||||
|
@ -226,8 +226,8 @@ func (db *mysql) SqlType(c *core.Column) string {
|
||||||
res = t
|
res = t
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasLen1 bool = (c.Length > 0)
|
hasLen1 := (c.Length > 0)
|
||||||
var hasLen2 bool = (c.Length2 > 0)
|
hasLen2 := (c.Length2 > 0)
|
||||||
|
|
||||||
if res == core.BigInt && !hasLen1 && !hasLen2 {
|
if res == core.BigInt && !hasLen1 && !hasLen2 {
|
||||||
c.Length = 20
|
c.Length = 20
|
||||||
|
|
|
@ -525,8 +525,9 @@ func (db *oracle) SqlType(c *core.Column) string {
|
||||||
res = t
|
res = t
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasLen1 bool = (c.Length > 0)
|
hasLen1 := (c.Length > 0)
|
||||||
var hasLen2 bool = (c.Length2 > 0)
|
hasLen2 := (c.Length2 > 0)
|
||||||
|
|
||||||
if hasLen2 {
|
if hasLen2 {
|
||||||
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
||||||
} else if hasLen1 {
|
} else if hasLen1 {
|
||||||
|
|
|
@ -812,8 +812,9 @@ func (db *postgres) SqlType(c *core.Column) string {
|
||||||
res = t
|
res = t
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasLen1 bool = (c.Length > 0)
|
hasLen1 := (c.Length > 0)
|
||||||
var hasLen2 bool = (c.Length2 > 0)
|
hasLen2 := (c.Length2 > 0)
|
||||||
|
|
||||||
if hasLen2 {
|
if hasLen2 {
|
||||||
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")"
|
||||||
} else if hasLen1 {
|
} else if hasLen1 {
|
||||||
|
@ -879,9 +880,10 @@ func (db *postgres) ModifyColumnSql(tableName string, col *core.Column) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *postgres) DropIndexSql(tableName string, index *core.Index) string {
|
func (db *postgres) DropIndexSql(tableName string, index *core.Index) string {
|
||||||
quote := db.Quote
|
|
||||||
//var unique string
|
//var unique string
|
||||||
var idxName string = index.Name
|
quote := db.Quote
|
||||||
|
idxName := index.Name
|
||||||
|
|
||||||
if !strings.HasPrefix(idxName, "UQE_") &&
|
if !strings.HasPrefix(idxName, "UQE_") &&
|
||||||
!strings.HasPrefix(idxName, "IDX_") {
|
!strings.HasPrefix(idxName, "IDX_") {
|
||||||
if index.Type == core.UniqueType {
|
if index.Type == core.UniqueType {
|
||||||
|
|
|
@ -237,9 +237,10 @@ func (db *sqlite3) TableCheckSql(tableName string) (string, []interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *sqlite3) DropIndexSql(tableName string, index *core.Index) string {
|
func (db *sqlite3) DropIndexSql(tableName string, index *core.Index) string {
|
||||||
quote := db.Quote
|
|
||||||
//var unique string
|
//var unique string
|
||||||
var idxName string = index.Name
|
quote := db.Quote
|
||||||
|
idxName := index.Name
|
||||||
|
|
||||||
if !strings.HasPrefix(idxName, "UQE_") &&
|
if !strings.HasPrefix(idxName, "UQE_") &&
|
||||||
!strings.HasPrefix(idxName, "IDX_") {
|
!strings.HasPrefix(idxName, "IDX_") {
|
||||||
if index.Type == core.UniqueType {
|
if index.Type == core.UniqueType {
|
||||||
|
|
Loading…
Reference in New Issue