Skip to content

Commit

Permalink
*: Make go vet happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaut committed Nov 23, 2015
1 parent 01a7171 commit d8ae7c1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
11 changes: 6 additions & 5 deletions expression/in.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ func (n *PatternIn) Eval(ctx context.Context, args map[interface{}]interface{})
}

if n.Sel == nil {
if err := hasSameColumnCount(ctx, n.Expr, n.List...); err != nil {
return nil, errors.Trace(err)
err1 := hasSameColumnCount(ctx, n.Expr, n.List...)
if err1 != nil {
return nil, errors.Trace(err1)
}

var values []interface{}
values, err = evalExprList(ctx, args, n.List)
if err != nil {
return nil, errors.Trace(err)
values, err1 = evalExprList(ctx, args, n.List)
if err1 != nil {
return nil, errors.Trace(err1)
}

return n.checkInList(lhs, values)
Expand Down
4 changes: 2 additions & 2 deletions expression/isnull.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ func (is *IsNull) String() string {
}

// Eval implements the Expression Eval interface.
func (is *IsNull) Eval(ctx context.Context, args map[interface{}]interface{}) (v interface{}, err error) {
func (is *IsNull) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) {
if err := CheckOneColumn(ctx, is.Expr); err != nil {
return nil, errors.Trace(err)
}

val, err := is.Expr.Eval(ctx, args)
if err != nil {
return
return nil, errors.Trace(err)
}

return types.IsNil(val) != is.Not, nil
Expand Down
6 changes: 3 additions & 3 deletions expression/istruth.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ func (is *IsTruth) String() string {
}

// Eval implements the Expression Eval interface.
func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) (v interface{}, err error) {
func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) {
if err := CheckOneColumn(ctx, is.Expr); err != nil {
return nil, errors.Trace(err)
}

val, err := is.Expr.Eval(ctx, args)
if err != nil {
return
return nil, errors.Trace(err)
}

if types.IsNil(val) {
Expand All @@ -81,7 +81,7 @@ func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) (

b, err := types.ToBool(val)
if err != nil {
return
return nil, errors.Trace(err)
}

if !is.Not {
Expand Down
2 changes: 1 addition & 1 deletion interpreter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func main() {
}

if strings.HasPrefix(txnLine, "COMMIT") || strings.HasPrefix(txnLine, "commit") {
err := tx.Commit()
err = tx.Commit()
if err != nil {
log.Error(errors.ErrorStack(err))
tx.Rollback()
Expand Down
10 changes: 5 additions & 5 deletions plan/plans/groupby.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error {
// TODO: later order by will use the same mechanism, so we may use another plan to do this
evalArgs := map[interface{}]interface{}{}
// must first eval none aggregate fields, because alias group by will use this.
if err := r.evalNoneAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil {
if err = r.evalNoneAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil {
return errors.Trace(err)
}

// update outer query becuase group by may use it if it has a subquery.
updateRowStack(ctx, row.Data, row.FromData)

if err := r.evalGroupKey(ctx, k, row.Data, srcRow.Data); err != nil {
if err = r.evalGroupKey(ctx, k, row.Data, srcRow.Data); err != nil {
return errors.Trace(err)
}

Expand All @@ -298,7 +298,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error {
index = len(r.rows)
r.rows = append(r.rows, &groupRow{Row: row, Args: evalArgs})

if err := t.Set(k, []interface{}{index}); err != nil {
if err = t.Set(k, []interface{}{index}); err != nil {
return errors.Trace(err)
}
} else {
Expand All @@ -310,7 +310,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error {
}

// eval aggregate fields
if err := r.evalAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil {
if err = r.evalAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil {
return errors.Trace(err)
}
}
Expand All @@ -326,7 +326,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error {
} else {
for _, row := range r.rows {
// eval aggregate done
if err := r.evalAggDone(ctx, row.Row.Data, row.Args); err != nil {
if err = r.evalAggDone(ctx, row.Row.Data, row.Args); err != nil {
return errors.Trace(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion rset/rsets/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (r *JoinRset) buildSourcePlan(ctx context.Context, t *TableSource) (plan.Pl
return nil, nil, errors.Trace(err)
}
src = tr
if err := r.checkTableDuplicate(t, tr); err != nil {
if err = r.checkTableDuplicate(t, tr); err != nil {
return nil, nil, errors.Trace(err)
}
case stmt.Statement:
Expand Down
2 changes: 1 addition & 1 deletion table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (t *Table) removeRowData(ctx context.Context, h int64) error {
// Remove row's colume one by one
for _, col := range t.Cols() {
k := t.RecordKey(h, col)
err := txn.Delete([]byte(k))
err = txn.Delete([]byte(k))
if err != nil {
return errors.Trace(err)
}
Expand Down

0 comments on commit d8ae7c1

Please sign in to comment.