Skip to content

Commit

Permalink
gofmt -s -w .
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza committed May 5, 2021
1 parent dd2e852 commit 0f860c5
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion ee/backup/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func runExportBackup() error {
glog.Infof("Created temporary map directory: %s\n", mapDir)

// TODO: Can probably make this procesing concurrent.
for gid, _ := range latestManifest.Groups {
for gid := range latestManifest.Groups {
glog.Infof("Exporting group: %d", gid)
req := &pb.RestoreRequest{
GroupId: gid,
Expand Down
12 changes: 6 additions & 6 deletions graphql/e2e/common/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func graphQLCompletionOn(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 5, len(result.QueryCountry))
expected.QueryCountry = []*country{
&country{Name: "Angola"},
&country{Name: "Bangladesh"},
&country{Name: "India"},
&country{Name: "Mozambique"},
{Name: "Angola"},
{Name: "Bangladesh"},
{Name: "India"},
{Name: "Mozambique"},
nil,
}

Expand Down Expand Up @@ -269,8 +269,8 @@ func panicCatcher(t *testing.T) {
// the http stack.

tests := map[string]*GraphQLParams{
"query": &GraphQLParams{Query: `query { queryCountry { name } }`},
"mutation": &GraphQLParams{
"query": {Query: `query { queryCountry { name } }`},
"mutation": {
Query: `mutation {
addCountry(input: [{ name: "A Country" }]) { country { id } }
}`,
Expand Down
34 changes: 17 additions & 17 deletions graphql/e2e/common/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ func queryByTypeWithEncoding(t *testing.T, acceptGzip, gzipEncoding bool) {
QueryCountry []*country
}
expected.QueryCountry = []*country{
&country{Name: "Angola"},
&country{Name: "Bangladesh"},
&country{Name: "India"},
&country{Name: "Mozambique"},
{Name: "Angola"},
{Name: "Bangladesh"},
{Name: "India"},
{Name: "Mozambique"},
}
err := json.Unmarshal([]byte(gqlResponse.Data), &result)
require.NoError(t, err)
Expand Down Expand Up @@ -197,10 +197,10 @@ func uidAlias(t *testing.T) {
QueryCountry []*countryUID
}
expected.QueryCountry = []*countryUID{
&countryUID{UID: "Angola"},
&countryUID{UID: "Bangladesh"},
&countryUID{UID: "India"},
&countryUID{UID: "Mozambique"},
{UID: "Angola"},
{UID: "Bangladesh"},
{UID: "India"},
{UID: "Mozambique"},
}
err := json.Unmarshal([]byte(gqlResponse.Data), &result)
require.NoError(t, err)
Expand All @@ -226,10 +226,10 @@ func orderAtRoot(t *testing.T) {
QueryCountry []*country
}
expected.QueryCountry = []*country{
&country{Name: "Angola"},
&country{Name: "Bangladesh"},
&country{Name: "India"},
&country{Name: "Mozambique"},
{Name: "Angola"},
{Name: "Bangladesh"},
{Name: "India"},
{Name: "Mozambique"},
}
err := json.Unmarshal([]byte(gqlResponse.Data), &result)
require.NoError(t, err)
Expand All @@ -255,8 +255,8 @@ func pageAtRoot(t *testing.T) {
QueryCountry []*country
}
expected.QueryCountry = []*country{
&country{Name: "India"},
&country{Name: "Bangladesh"},
{Name: "India"},
{Name: "Bangladesh"},
}
err := json.Unmarshal([]byte(gqlResponse.Data), &result)
require.NoError(t, err)
Expand All @@ -269,8 +269,8 @@ func pageAtRoot(t *testing.T) {
func regExp(t *testing.T) {
queryCountryByRegExp(t, "/[Aa]ng/",
[]*country{
&country{Name: "Angola"},
&country{Name: "Bangladesh"},
{Name: "Angola"},
{Name: "Bangladesh"},
})
}

Expand Down Expand Up @@ -300,7 +300,7 @@ func multipleSearchIndexes(t *testing.T) {
}

expected.QueryPost = []*post{
&post{Title: "Introducing GraphQL in Dgraph"},
{Title: "Introducing GraphQL in Dgraph"},
}
err := json.Unmarshal([]byte(gqlResponse.Data), &result)
require.NoError(t, err)
Expand Down
14 changes: 7 additions & 7 deletions graphql/e2e/custom_logic/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ func deleteCommonHeaders(headers http.Header) {
func carsHandlerWithHeaders(w http.ResponseWriter, r *http.Request) {
deleteCommonHeaders(r.Header)
if err := compareHeaders(map[string][]string{
"Stripe-Api-Key": []string{"some-api-key"},
"Stripe-Api-Key": {"some-api-key"},
}, r.Header); err != nil {
check2(w.Write([]byte(err.Error())))
return
Expand All @@ -835,7 +835,7 @@ func carsHandlerWithHeaders(w http.ResponseWriter, r *http.Request) {
func userNameHandlerWithHeaders(w http.ResponseWriter, r *http.Request) {
deleteCommonHeaders(r.Header)
if err := compareHeaders(map[string][]string{
"Github-Api-Token": []string{"some-api-token"},
"Github-Api-Token": {"some-api-token"},
}, r.Header); err != nil {
check2(w.Write([]byte(err.Error())))
return
Expand Down Expand Up @@ -1037,7 +1037,7 @@ func (_ *query) Countries(ctx context.Context, args struct {
Name string
}
}) []countryResolver {
return []countryResolver{countryResolver{&country{
return []countryResolver{{&country{
Code: graphql.ID(args.Filter.Code),
Name: args.Filter.Name,
}}}
Expand Down Expand Up @@ -1142,7 +1142,7 @@ func (r *classResolver) Name() string {
func (_ *query) Class(ctx context.Context, args struct {
Id string
}) *[]*classResolver {
return &[]*classResolver{&classResolver{&class{ID: graphql.ID(args.Id)}}}
return &[]*classResolver{{&class{ID: graphql.ID(args.Id)}}}
}

func (_ *query) UserNames(ctx context.Context, args struct {
Expand Down Expand Up @@ -1190,7 +1190,7 @@ func (_ *query) Classes(ctx context.Context, args struct {
resolvers := make([]*[]*classResolver, 0, len(*args.Schools))
for _, user := range *args.Schools {
resolvers = append(resolvers, &[]*classResolver{
&classResolver{&class{ID: graphql.ID(user.Id)}}})
{&class{ID: graphql.ID(user.Id)}}})
}
return &resolvers
}
Expand Down Expand Up @@ -1264,10 +1264,10 @@ func gqlCarsWithErrorHandler(w http.ResponseWriter, r *http.Request) {
"cars": output,
},
"errors": []map[string]interface{}{
map[string]interface{}{
{
"message": "error-1 from cars",
},
map[string]interface{}{
{
"message": "error-2 from cars",
},
},
Expand Down
12 changes: 6 additions & 6 deletions graphql/e2e/custom_logic/custom_logic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ func TestCustomQueryShouldForwardHeaders(t *testing.T) {
params := &common.GraphQLParams{
Query: query,
Headers: map[string][]string{
"X-App-Token": []string{"app-token"},
"X-User-Id": []string{"123"},
"Random-header": []string{"random"},
"X-App-Token": {"app-token"},
"X-User-Id": {"123"},
"Random-header": {"random"},
},
}

Expand Down Expand Up @@ -238,9 +238,9 @@ func TestCustomNameForwardHeaders(t *testing.T) {
params := &common.GraphQLParams{
Query: query,
Headers: map[string][]string{
"App": []string{"app-token"},
"X-User-Id": []string{"123"},
"Random-header": []string{"random"},
"App": {"app-token"},
"X-User-Id": {"123"},
"Random-header": {"random"},
},
}

Expand Down
10 changes: 5 additions & 5 deletions graphql/resolve/mutation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ func TestMutationQueryRewriting(t *testing.T) {
}

allowedTestTypes := map[string][]string{
"UPDATE_MUTATION": []string{"Update Post "},
"ADD_UPDATE_MUTATION": []string{"Add Post ", "Update Post "},
"UPDATE_MUTATION": {"Update Post "},
"ADD_UPDATE_MUTATION": {"Add Post ", "Update Post "},
}

b, err := ioutil.ReadFile("mutation_query_test.yaml")
Expand Down Expand Up @@ -421,9 +421,9 @@ func TestCustomHTTPMutation(t *testing.T) {
Query: tcase.GQLQuery,
Variables: vars,
Header: map[string][]string{
"bogus": []string{"header"},
"X-App-Token": []string{"val"},
"Auth0-Token": []string{"tok"},
"bogus": {"header"},
"X-App-Token": {"val"},
"Auth0-Token": {"tok"},
},
})
require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions graphql/resolve/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ func TestCustomHTTPQuery(t *testing.T) {
Query: tcase.GQLQuery,
Variables: vars,
Header: map[string][]string{
"bogus": []string{"header"},
"X-App-Token": []string{"val"},
"Auth0-Token": []string{"tok"},
"bogus": {"header"},
"X-App-Token": {"val"},
"Auth0-Token": {"tok"},
},
})
require.NoError(t, err)
Expand Down
32 changes: 16 additions & 16 deletions graphql/resolve/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": { "dob": null }}`,
Errors: x.GqlErrorList{{
Message: schema.ErrExpectedScalar,
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "dob"},
}}},

Expand All @@ -45,7 +45,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": { "dob": null }}`,
Errors: x.GqlErrorList{{
Message: schema.ErrExpectedScalar,
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "dob"},
}}},

Expand All @@ -55,7 +55,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": { "country": null }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value 'Rwanda' for field 'country' to type Country.",
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "country"},
}}},
{Name: "return error when array is returned instead of object value",
Expand All @@ -64,7 +64,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": { "country": null }}`,
Errors: x.GqlErrorList{{
Message: schema.ErrExpectedSingleItem,
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "country"},
}}},

Expand All @@ -74,7 +74,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": null}`,
Errors: x.GqlErrorList{{
Message: schema.ErrExpectedList,
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor"},
}}},
{Name: "return error when object is returned instead of array value",
Expand All @@ -83,7 +83,7 @@ func TestErrorOnIncorrectValueType(t *testing.T) {
Expected: `{ "getAuthor": null}`,
Errors: x.GqlErrorList{{
Message: schema.ErrExpectedList,
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor"},
}}},
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "postType": [2] }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '2' for field 'postType' to type PostType.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "postType", 0},
}},
Expected: `{ "getPost": { "postType": [null] }}`},
Expand All @@ -132,7 +132,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "postType": [2.134] }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '2.134' for field 'postType' to type PostType.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "postType", 0},
}},
Expected: `{ "getPost": { "postType": [null] }}`},
Expand All @@ -141,7 +141,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "postType": [false] }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value 'false' for field 'postType' to type PostType.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "postType", 0},
}},
Expected: `{ "getPost": { "postType": [null] }}`},
Expand All @@ -150,7 +150,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "postType": ["Random"] }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value 'Random' for field 'postType' to type PostType.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "postType", 0},
}},
Expected: `{ "getPost": { "postType": [null] }}`},
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestValueCoercion(t *testing.T) {
Errors: x.GqlErrorList{{
Message: "Error coercing value '2147483648' for field 'numLikes' to type" +
" Int.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "numLikes"},
}},
Expected: `{"getPost": {"numLikes": null}}`,
Expand All @@ -224,7 +224,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "numLikes": 123.23 }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '123.23' for field 'numLikes' to type Int.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "numLikes"},
}},
Expected: `{"getPost": {"numLikes": null}}`,
Expand All @@ -235,7 +235,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getPost": { "numLikes": "123.23" }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '123.23' for field 'numLikes' to type Int.",
Locations: []x.Location{x.Location{Line: 1, Column: 34}},
Locations: []x.Location{{Line: 1, Column: 34}},
Path: []interface{}{"getPost", "numLikes"},
}},
Expected: `{"getPost": {"numLikes": null}}`,
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getAuthor": { "dob": "23.123" }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '23.123' for field 'dob' to type DateTime.",
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "dob"},
}},
Expected: `{ "getAuthor": { "dob": null }}`},
Expand All @@ -274,7 +274,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getAuthor": { "dob": true }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value 'true' for field 'dob' to type DateTime.",
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "dob"},
}},
Expected: `{ "getAuthor": { "dob": null }}`},
Expand All @@ -283,7 +283,7 @@ func TestValueCoercion(t *testing.T) {
Response: `{ "getAuthor": { "dob": "123" }}`,
Errors: x.GqlErrorList{{
Message: "Error coercing value '123' for field 'dob' to type DateTime.",
Locations: []x.Location{x.Location{Line: 1, Column: 32}},
Locations: []x.Location{{Line: 1, Column: 32}},
Path: []interface{}{"getAuthor", "dob"},
}},
Expected: `{ "getAuthor": { "dob": null}}`},
Expand Down
8 changes: 4 additions & 4 deletions query/fastjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ func subgraphWithSingleResultAndSingleValue(val *pb.TaskValue) *SubGraph {
Params: params{Alias: "query"},
SrcUIDs: &pb.List{Uids: []uint64{1}},
DestUIDs: &pb.List{Uids: []uint64{1}},
uidMatrix: []*pb.List{&pb.List{Uids: []uint64{1}}},
uidMatrix: []*pb.List{{Uids: []uint64{1}}},
Children: []*SubGraph{
&SubGraph{
{
Attr: "val",
SrcUIDs: &pb.List{Uids: []uint64{1}},
uidMatrix: []*pb.List{&pb.List{}},
uidMatrix: []*pb.List{{}},
valueMatrix: []*pb.ValueList{
// UID 1
&pb.ValueList{
{
Values: []*pb.TaskValue{val},
},
},
Expand Down
Loading

0 comments on commit 0f860c5

Please sign in to comment.