diff --git a/examples/fixtures.go b/examples/fixtures.go index 220c6d7..7d0402d 100644 --- a/examples/fixtures.go +++ b/examples/fixtures.go @@ -8,31 +8,31 @@ func fixtureBlogCreate(i int) *Blog { Title: "Title 1", CreatedAt: time.Now(), Posts: []*Post{ - &Post{ + { ID: 1 * i, Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1 * i, Body: "foo", }, - &Comment{ + { ID: 2 * i, Body: "bar", }, }, }, - &Post{ + { ID: 2 * i, Title: "Fuubar", Body: "Bas", Comments: []*Comment{ - &Comment{ + { ID: 1 * i, Body: "foo", }, - &Comment{ + { ID: 3 * i, Body: "bas", }, @@ -44,11 +44,11 @@ func fixtureBlogCreate(i int) *Blog { Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1 * i, Body: "foo", }, - &Comment{ + { ID: 2 * i, Body: "bar", }, diff --git a/request_test.go b/request_test.go index 6b47fd7..2206449 100644 --- a/request_test.go +++ b/request_test.go @@ -753,7 +753,7 @@ func samplePayload() io.Reader { Relationships: map[string]interface{}{ "posts": &RelationshipManyNode{ Data: []*Node{ - &Node{ + { Type: "posts", Attributes: map[string]interface{}{ "title": "Foo", @@ -761,7 +761,7 @@ func samplePayload() io.Reader { }, ClientID: "1", }, - &Node{ + { Type: "posts", Attributes: map[string]interface{}{ "title": "X", @@ -782,14 +782,14 @@ func samplePayload() io.Reader { Relationships: map[string]interface{}{ "comments": &RelationshipManyNode{ Data: []*Node{ - &Node{ + { Type: "comments", Attributes: map[string]interface{}{ "body": "Great post!", }, ClientID: "4", }, - &Node{ + { Type: "comments", Attributes: map[string]interface{}{ "body": "Needs some work!", @@ -866,16 +866,16 @@ func testModel() *Blog { Title: "Title 1", CreatedAt: time.Now(), Posts: []*Post{ - &Post{ + { ID: 1, Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 2, Body: "bar", }, @@ -885,16 +885,16 @@ func testModel() *Blog { Body: "foo", }, }, - &Post{ + { ID: 2, Title: "Fuubar", Body: "Bas", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 3, Body: "bas", }, @@ -910,11 +910,11 @@ func testModel() *Blog { Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 2, Body: "bar", }, diff --git a/response_test.go b/response_test.go index 76529b7..9b0bf57 100644 --- a/response_test.go +++ b/response_test.go @@ -11,7 +11,7 @@ import ( func TestMarshalPayload(t *testing.T) { book := &Book{ID: 1} - books := []*Book{book, &Book{ID: 2}} + books := []*Book{book, {ID: 2}} var jsonData map[string]interface{} // One @@ -623,11 +623,11 @@ func TestMarshalPayloadWithoutIncluded(t *testing.T) { Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 20, Body: "First", }, - &Comment{ + { ID: 21, Body: "Hello World", }, @@ -660,12 +660,12 @@ func TestMarshalPayload_many(t *testing.T) { Title: "Title 1", CreatedAt: time.Now(), Posts: []*Post{ - &Post{ + { ID: 1, Title: "Foo", Body: "Bar", }, - &Post{ + { ID: 2, Title: "Fuubar", Body: "Bas", @@ -682,12 +682,12 @@ func TestMarshalPayload_many(t *testing.T) { Title: "Title 2", CreatedAt: time.Now(), Posts: []*Post{ - &Post{ + { ID: 3, Title: "Foo", Body: "Bar", }, - &Post{ + { ID: 4, Title: "Fuubar", Body: "Bas", @@ -770,8 +770,8 @@ func TestMarshalManyWithoutIncluded(t *testing.T) { func TestMarshalMany_SliceOfInterfaceAndSliceOfStructsSameJSON(t *testing.T) { structs := []*Book{ - &Book{ID: 1, Author: "aren55555", ISBN: "abc"}, - &Book{ID: 2, Author: "shwoodard", ISBN: "xyz"}, + {ID: 1, Author: "aren55555", ISBN: "abc"}, + {ID: 2, Author: "shwoodard", ISBN: "xyz"}, } interfaces := []interface{}{} for _, s := range structs { @@ -823,16 +823,16 @@ func testBlog() *Blog { Title: "Title 1", CreatedAt: time.Now(), Posts: []*Post{ - &Post{ + { ID: 1, Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 2, Body: "bar", }, @@ -842,16 +842,16 @@ func testBlog() *Blog { Body: "foo", }, }, - &Post{ + { ID: 2, Title: "Fuubar", Body: "Bas", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 3, Body: "bas", }, @@ -867,11 +867,11 @@ func testBlog() *Blog { Title: "Foo", Body: "Bar", Comments: []*Comment{ - &Comment{ + { ID: 1, Body: "foo", }, - &Comment{ + { ID: 2, Body: "bar", },