Skip to content

Commit

Permalink
simplify switch for gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpner committed Sep 1, 2015
1 parent 53a1d93 commit 3d969f4
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 68 deletions.
38 changes: 19 additions & 19 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,20 +464,20 @@ var _ = Describe("RestHandler", func() {

BeforeEach(func() {
source = &fixtureSource{map[string]*Post{
"1": &Post{
"1": {
ID: "1",
Title: "Hello, World!",
Author: &User{
ID: "1",
Name: "Dieter",
},
Comments: []Comment{Comment{
Comments: []Comment{{
ID: "1",
Value: "This is a stupid post!",
}},
},
"2": &Post{ID: "2", Title: "I am NR. 2"},
"3": &Post{ID: "3", Title: "I am NR. 3"},
"2": {ID: "2", Title: "I am NR. 2"},
"3": {ID: "3", Title: "I am NR. 3"},
}, usePointerResources}

post1Json = map[string]interface{}{
Expand All @@ -500,7 +500,7 @@ var _ = Describe("RestHandler", func() {
},
"comments": map[string]interface{}{
"data": []map[string]interface{}{
map[string]interface{}{
{
"id": "1",
"type": "comments",
},
Expand All @@ -521,14 +521,14 @@ var _ = Describe("RestHandler", func() {
}

post1LinkedJSON = []map[string]interface{}{
map[string]interface{}{
{
"id": "1",
"type": "users",
"attributes": map[string]interface{}{
"name": "Dieter",
},
},
map[string]interface{}{
{
"id": "1",
"type": "comments",
"attributes": map[string]interface{}{
Expand Down Expand Up @@ -985,7 +985,7 @@ var _ = Describe("RestHandler", func() {

BeforeEach(func() {
source = &fixtureSource{map[string]*Post{
"1": &Post{ID: "1", Title: "Hello, World!"},
"1": {ID: "1", Title: "Hello, World!"},
}, false}

post1Json = map[string]interface{}{
Expand Down Expand Up @@ -1023,7 +1023,7 @@ var _ = Describe("RestHandler", func() {

BeforeEach(func() {
source = &fixtureSource{map[string]*Post{
"1": &Post{ID: "1", Title: "Hello, World!"},
"1": {ID: "1", Title: "Hello, World!"},
}, false}

jsonResponse = `{"data":{"attributes":{"title":"Hello, World!","value":null},"id":"1","relationships":{"author":{"data":null,"links":{"related":"/posts/1/author","self":"/posts/1/relationships/author"}},"bananas":{"data":[],"links":{"related":"/posts/1/bananas","self":"/posts/1/relationships/bananas"}},"comments":{"data":[],"links":{"related":"/posts/1/comments","self":"/posts/1/relationships/comments"}}},"type":"posts"}}`
Expand Down Expand Up @@ -1139,8 +1139,8 @@ var _ = Describe("RestHandler", func() {

BeforeEach(func() {
source = &fixtureSource{map[string]*Post{
"1": &Post{ID: "1", Title: "Hello, World!"},
"2": &Post{ID: "2", Title: "Hello, from second Post!"},
"1": {ID: "1", Title: "Hello, World!"},
"2": {ID: "2", Title: "Hello, from second Post!"},
}, false}

post1JSON = map[string]interface{}{
Expand Down Expand Up @@ -1243,7 +1243,7 @@ var _ = Describe("RestHandler", func() {
Expect(err).To(BeNil())

api2goReq := buildRequest(req)
Expect(api2goReq.QueryParams).To(Equal(map[string][]string{"sort": []string{"title", "date"}}))
Expect(api2goReq.QueryParams).To(Equal(map[string][]string{"sort": {"title", "date"}}))
})
})

Expand All @@ -1256,13 +1256,13 @@ var _ = Describe("RestHandler", func() {

BeforeEach(func() {
source = &fixtureSource{map[string]*Post{
"1": &Post{ID: "1", Title: "Hello, World!"},
"2": &Post{ID: "2", Title: "Hello, World!"},
"3": &Post{ID: "3", Title: "Hello, World!"},
"4": &Post{ID: "4", Title: "Hello, World!"},
"5": &Post{ID: "5", Title: "Hello, World!"},
"6": &Post{ID: "6", Title: "Hello, World!"},
"7": &Post{ID: "7", Title: "Hello, World!"},
"1": {ID: "1", Title: "Hello, World!"},
"2": {ID: "2", Title: "Hello, World!"},
"3": {ID: "3", Title: "Hello, World!"},
"4": {ID: "4", Title: "Hello, World!"},
"5": {ID: "5", Title: "Hello, World!"},
"6": {ID: "6", Title: "Hello, World!"},
"7": {ID: "7", Title: "Hello, World!"},
}, false}

api = NewAPI("v1")
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (j JSONContentMarshaler) MarshalError(err error) string {
//marshalHTTPError marshals an internal httpError
func marshalHTTPError(input HTTPError, marshaler ContentMarshaler) string {
if len(input.Errors) == 0 {
input.Errors = []Error{Error{Title: input.msg, Status: strconv.Itoa(input.status)}}
input.Errors = []Error{{Title: input.msg, Status: strconv.Itoa(input.status)}}
}

data, err := marshaler.Marshal(input)
Expand Down
8 changes: 4 additions & 4 deletions jsonapi/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ var _ = Describe("Test for the public api of this package", func() {
}

pages := []Page{
Page{ID: "Page 1", Content: "First Page"},
Page{ID: "Page 2", Content: "Second Page"},
Page{ID: "Page 3", Content: "Final page"},
{ID: "Page 1", Content: "First Page"},
{ID: "Page 2", Content: "Second Page"},
{ID: "Page 3", Content: "Final page"},
}

testBook := Book{
Expand Down Expand Up @@ -227,7 +227,7 @@ var _ = Describe("Test for the public api of this package", func() {
It("Should be unmarshalled correctly", func() {
result := &[]Book{}
expected := []Book{
Book{
{
ID: "TheOneAndOnlyID",
AuthorID: "A Magical UserID",
PagesIDs: []string{"Page 1", "Page 2", "Page 3"},
Expand Down
6 changes: 3 additions & 3 deletions jsonapi/marshal_same_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ var _ = Describe("Marshalling with the same reference type", func() {
"content": "I am the Super Node",
},
"relationships": map[string]map[string]interface{}{
"mother-node": map[string]interface{}{
"mother-node": {
"data": map[string]interface{}{
"type": "nodes",
"id": "1337",
},
},
"child-nodes": map[string]interface{}{
"child-nodes": {
"data": []map[string]interface{}{
{
"type": "nodes",
Expand All @@ -96,7 +96,7 @@ var _ = Describe("Marshalling with the same reference type", func() {
},
},
},
"abandoned-child-nodes": map[string]interface{}{
"abandoned-child-nodes": {
"data": []map[string]interface{}{
{
"type": "nodes",
Expand Down
Loading

0 comments on commit 3d969f4

Please sign in to comment.