Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass gofmt #32

Merged
merged 1 commit into from
Sep 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions expression/expressions/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s *testHelperSuite) TestContainAggFunc(c *C) {
{&FunctionCast{Expr: v}, false},
{&FunctionConvert{Expr: v}, false},
{&FunctionSubstring{StrExpr: v, Pos: v, Len: v}, false},
{&FunctionCase{Value: v, WhenClauses: []*WhenClause{&WhenClause{Expr: v, Result: v}}, ElseClause: v}, false},
{&FunctionCase{Value: v, WhenClauses: []*WhenClause{{Expr: v, Result: v}}, ElseClause: v}, false},
{&WhenClause{Expr: v, Result: v}, false},
{&IsTruth{Expr: v}, false},
{&Between{Expr: v, Left: v, Right: v}, false},
Expand Down Expand Up @@ -67,7 +67,7 @@ func (s *testHelperSuite) TestMentionedColumns(c *C) {
{&FunctionCast{Expr: v}, 0},
{&FunctionConvert{Expr: v}, 0},
{&FunctionSubstring{StrExpr: v, Pos: v, Len: v}, 0},
{&FunctionCase{Value: v, WhenClauses: []*WhenClause{&WhenClause{Expr: v, Result: v}}, ElseClause: v}, 0},
{&FunctionCase{Value: v, WhenClauses: []*WhenClause{{Expr: v, Result: v}}, ElseClause: v}, 0},
{&WhenClause{Expr: v, Result: v}, 0},
{&IsTruth{Expr: v}, 0},
{&Between{Expr: v, Left: v, Right: v}, 0},
Expand Down
2 changes: 1 addition & 1 deletion infoschema/infoschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (*testSuite) TestT(c *C) {
Name: idxName,
Table: tbName,
Columns: []*model.IndexColumn{
&model.IndexColumn{
{
Name: colName,
Offset: 0,
Length: 10,
Expand Down
2 changes: 1 addition & 1 deletion parser/coldef/col_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func ColumnDefToCol(offset int, colDef *ColumnDef) (*column.Col, []*TableConstra
hasDefaultValue := false
if colDef.Constraints != nil {
keys := []*IndexColName{
&IndexColName{
{
colDef.Name,
colDef.Tp.Flen,
},
Expand Down
16 changes: 8 additions & 8 deletions plan/plans/distinct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ type testTablePlan struct {
}

var distinctTestData = []*testRowData{
&testRowData{1, []interface{}{10, "hello"}},
&testRowData{2, []interface{}{10, "hello"}},
&testRowData{3, []interface{}{10, "hello"}},
&testRowData{4, []interface{}{40, "hello"}},
&testRowData{6, []interface{}{60, "hello"}},
{1, []interface{}{10, "hello"}},
{2, []interface{}{10, "hello"}},
{3, []interface{}{10, "hello"}},
{4, []interface{}{40, "hello"}},
{6, []interface{}{60, "hello"}},
}

func (p *testTablePlan) Do(ctx context.Context, f plan.RowIterFunc) error {
Expand Down Expand Up @@ -94,9 +94,9 @@ func (t *testDistinctSuit) TestDistinct(c *C) {
c.Assert(err, IsNil)

expected := map[int][]interface{}{
10: []interface{}{10, "hello"},
40: []interface{}{40, "hello"},
60: []interface{}{60, "hello"},
10: {10, "hello"},
40: {40, "hello"},
60: {60, "hello"},
}

c.Assert(reflect.DeepEqual(r, expected), Equals, true)
Expand Down
2 changes: 1 addition & 1 deletion plan/plans/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *ExplainDefaultPlan) Explain(w format.Formatter) {

// GetFields implements the plan.Plan GetFields interface.
func (r *ExplainDefaultPlan) GetFields() []*field.ResultField {
return []*field.ResultField{&field.ResultField{Name: ""}}
return []*field.ResultField{{Name: ""}}
}

// Filter implements the plan.Plan Filter interface.
Expand Down
22 changes: 11 additions & 11 deletions plan/plans/fields_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ type testFieldsSuit struct{}
var _ = Suite(&testFieldsSuit{})

var selectFieldsTestData = []*testRowData{
&testRowData{1, []interface{}{10, "hello"}},
&testRowData{2, []interface{}{20, "hello"}},
&testRowData{3, []interface{}{30, "hello"}},
&testRowData{4, []interface{}{40, "hello"}},
&testRowData{5, []interface{}{50, "hello"}},
&testRowData{6, []interface{}{60, "hello"}},
{1, []interface{}{10, "hello"}},
{2, []interface{}{20, "hello"}},
{3, []interface{}{30, "hello"}},
{4, []interface{}{40, "hello"}},
{5, []interface{}{50, "hello"}},
{6, []interface{}{60, "hello"}},
}

func (s *testFieldsSuit) TestDefaultFieldsPlan(c *C) {
tblPlan := &testTablePlan{selectFieldsTestData, []string{"id", "name"}}

sl1 := &SelectList{
Fields: []*field.Field{
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("name"),
},
Expand All @@ -60,12 +60,12 @@ func (s *testFieldsSuit) TestDefaultFieldsPlan(c *C) {
// test multiple fields
sl2 := &SelectList{
Fields: []*field.Field{
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("name"),
},
},
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("id"),
},
Expand All @@ -88,7 +88,7 @@ func (s *testFieldsSuit) TestDefaultFieldsPlan(c *C) {
// test field doesn't exists
sl3 := &SelectList{
Fields: []*field.Field{
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("nosuchfield"),
},
Expand All @@ -108,7 +108,7 @@ func (s *testFieldsSuit) TestDefaultFieldsPlan(c *C) {
func (s *testFieldsSuit) TestSelectExprPlan(c *C) {
pln := &SelectEmptyFieldListPlan{
Fields: []*field.Field{
&field.Field{
{
Expr: &expressions.Value{
Val: "data",
},
Expand Down
10 changes: 5 additions & 5 deletions plan/plans/final_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ type testFinalPlan struct{}
var _ = Suite(&testFinalPlan{})

var finalTestData = []*testRowData{
&testRowData{1, []interface{}{10, "hello", true}},
&testRowData{2, []interface{}{10, "hello", true}},
&testRowData{3, []interface{}{10, "hello", true}},
&testRowData{4, []interface{}{40, "hello", true}},
&testRowData{6, []interface{}{60, "hello", false}},
{1, []interface{}{10, "hello", true}},
{2, []interface{}{10, "hello", true}},
{3, []interface{}{10, "hello", true}},
{4, []interface{}{40, "hello", true}},
{6, []interface{}{60, "hello", false}},
}

func (t *testFinalPlan) TestFinalPlan(c *C) {
Expand Down
6 changes: 3 additions & 3 deletions plan/plans/from_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (p *testFromSuit) SetUpSuite(c *C) {
p.vars = map[string]interface{}{}
p.txn, _ = store.Begin()
p.cols = []*column.Col{
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 0,
Name: model.NewCIStr("id"),
Expand All @@ -87,7 +87,7 @@ func (p *testFromSuit) SetUpSuite(c *C) {
FieldType: *types.NewFieldType(mysql.TypeLonglong),
},
},
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 1,
Name: model.NewCIStr("name"),
Expand Down Expand Up @@ -158,7 +158,7 @@ func (p *testFromSuit) TestTableDefaultPlan(c *C) {
Name: model.NewCIStr("id"),
Table: model.NewCIStr("t"),
Columns: []*model.IndexColumn{
&model.IndexColumn{
{
Name: model.NewCIStr("id"),
Offset: 0,
Length: 0,
Expand Down
18 changes: 9 additions & 9 deletions plan/plans/groupby_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@ type testGroupBySuite struct{}
var _ = Suite(&testGroupBySuite{})

var groupByTestData = []*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
}

func (t *testGroupBySuite) TestGroupBy(c *C) {
tblPlan := &testTablePlan{groupByTestData, []string{"id", "name"}}
// test multiple fields
sl := &SelectList{
Fields: []*field.Field{
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("id"),
},
},
&field.Field{
{
Expr: &expressions.Ident{
CIStr: model.NewCIStr("name"),
},
},
&field.Field{
{
Expr: &expressions.Call{
F: "sum",
Args: []expression.Expression{
Expand All @@ -59,7 +59,7 @@ func (t *testGroupBySuite) TestGroupBy(c *C) {
},
},
},
AggFields: map[int]struct{}{2: struct{}{}},
AggFields: map[int]struct{}{2: {}},
}

groupbyPlan := &GroupByDefaultPlan{
Expand Down
10 changes: 5 additions & 5 deletions plan/plans/having_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ type testHavingPlan struct{}
var _ = Suite(&testHavingPlan{})

var havingTestData = []*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
}

func (t *testHavingPlan) TestHaving(c *C) {
Expand Down
6 changes: 3 additions & 3 deletions plan/plans/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *testIndexSuit) SetUpSuite(c *C) {
p.vars = map[string]interface{}{}
p.txn, _ = p.store.Begin()
p.cols = []*column.Col{
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 0,
Name: model.NewCIStr("id"),
Expand All @@ -76,7 +76,7 @@ func (p *testIndexSuit) SetUpSuite(c *C) {
FieldType: *types.NewFieldType(mysql.TypeLonglong),
},
},
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 1,
Name: model.NewCIStr("name"),
Expand All @@ -93,7 +93,7 @@ func (p *testIndexSuit) SetUpSuite(c *C) {
Name: model.NewCIStr("id"),
Table: model.NewCIStr("t2"),
Columns: []*model.IndexColumn{
&model.IndexColumn{
{
Name: model.NewCIStr("id"),
Offset: 0,
Length: 0,
Expand Down
24 changes: 12 additions & 12 deletions plan/plans/join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = Suite(&testJoinSuit{})

func (s *testJoinSuit) TestJoin(c *C) {
s.cols = []*column.Col{
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 0,
Name: model.NewCIStr("id"),
Expand All @@ -41,7 +41,7 @@ func (s *testJoinSuit) TestJoin(c *C) {
FieldType: *types.NewFieldType(mysql.TypeLonglong),
},
},
&column.Col{
{
ColumnInfo: model.ColumnInfo{
ID: 1,
Name: model.NewCIStr("name"),
Expand All @@ -53,19 +53,19 @@ func (s *testJoinSuit) TestJoin(c *C) {
}

var testData1 = []*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
}

var testData2 = []*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
}

tblPlan1 := &testTablePlan{testData1, []string{"id", "name"}}
Expand Down
10 changes: 5 additions & 5 deletions plan/plans/limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ type testLimitSuit struct {

var _ = Suite(&testLimitSuit{
data: []*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
},
})

Expand Down
10 changes: 5 additions & 5 deletions plan/plans/orderby_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ type testOrderBySuit struct {

var _ = Suite(&testOrderBySuit{
[]*testRowData{
&testRowData{1, []interface{}{10, "10"}},
&testRowData{2, []interface{}{10, "20"}},
&testRowData{3, []interface{}{10, "30"}},
&testRowData{4, []interface{}{40, "40"}},
&testRowData{6, []interface{}{60, "60"}},
{1, []interface{}{10, "10"}},
{2, []interface{}{10, "20"}},
{3, []interface{}{10, "30"}},
{4, []interface{}{40, "40"}},
{6, []interface{}{60, "60"}},
},
})

Expand Down
2 changes: 1 addition & 1 deletion plan/plans/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (r *selectIndexDefaultPlan) Do(ctx context.Context, f plan.RowIterFunc) (er

// GetFields implements plan.Plan GetFields interface.
func (r *selectIndexDefaultPlan) GetFields() []*field.ResultField {
return []*field.ResultField{&field.ResultField{Name: r.nm}}
return []*field.ResultField{{Name: r.nm}}
}

// NullPlan is empty plan, if we can affirm that the resultset is empty, we
Expand Down
Loading