diff --git a/main.go b/main.go index bc934c9d..3a6eb5c1 100644 --- a/main.go +++ b/main.go @@ -119,7 +119,6 @@ func (s *DB) Limit(value interface{}) *DB { func (s *DB) Offset(value interface{}) *DB { return s.clone().search.offset(value).db - return s.clone().search.offset(value).db } func (s *DB) Order(value string, reorder ...bool) *DB { diff --git a/main_test.go b/main_test.go index 3071bf2d..7be913ed 100644 --- a/main_test.go +++ b/main_test.go @@ -311,13 +311,11 @@ func TestRows(t *testing.T) { } count := 0 - if rows != nil { - for rows.Next() { - var name string - var age int64 - rows.Scan(&name, &age) - count++ - } + for rows.Next() { + var name string + var age int64 + rows.Scan(&name, &age) + count++ } if count != 2 { t.Errorf("Should found two records with name 3") @@ -452,7 +450,7 @@ func TestTimeWithZone(t *testing.T) { name := "time_with_zone_" + strconv.Itoa(index) user := User{Name: name, Birthday: vtime} - //mssql does not support time zones + // TODO mssql does not support time zones if dialect := os.Getenv("GORM_DIALECT"); dialect == "mssql" { user.Birthday = vtime.UTC() } diff --git a/query_test.go b/query_test.go index 5d54ccac..b7ab1f5d 100644 --- a/query_test.go +++ b/query_test.go @@ -2,9 +2,10 @@ package gorm_test import ( "fmt" - "github.com/jinzhu/now" "reflect" + "github.com/jinzhu/now" + "testing" "time" ) @@ -239,11 +240,7 @@ func TestOrderAndPluck(t *testing.T) { var ages []int64 scopedb.Order("age desc").Pluck("age", &ages) - if ages != nil { - if ages[0] != 20 { - t.Errorf("The first age should be 20 when order with age desc") - } - } else { + if ages[0] != 20 { t.Errorf("The first age should be 20 when order with age desc") }