diff --git a/db/db_test.go b/db/db_test.go index 01234504..e811c9df 100644 --- a/db/db_test.go +++ b/db/db_test.go @@ -107,7 +107,7 @@ func TestNewClient(t *testing.T) { func TestNewClientAuthOverrides(t *testing.T) { cases := []map[string]interface{}{ nil, - map[string]interface{}{"uid": "user1"}, + {"uid": "user1"}, } for _, tc := range cases { c, err := NewClient(context.Background(), &internal.DatabaseConfig{ diff --git a/db/query.go b/db/query.go index c6013483..ca377c12 100644 --- a/db/query.go +++ b/db/query.go @@ -306,7 +306,7 @@ func (q *queryNodeImpl) Key() string { if q.CompKey.Str != nil { return *q.CompKey.Str } - // Numeric keys in queryNodeImpl are always array indices, and can be safely coverted into int. + // Numeric keys in queryNodeImpl are always array indices, and can be safely converted into int. return strconv.Itoa(int(*q.CompKey.Num)) } diff --git a/db/ref_test.go b/db/ref_test.go index 93e348d0..8c489467 100644 --- a/db/ref_test.go +++ b/db/ref_test.go @@ -265,12 +265,12 @@ func TestGetIfChanged(t *testing.T) { } checkAllRequests(t, mock.Reqs, []*testReq{ - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"If-None-Match": []string{"old-etag"}}, }, - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"If-None-Match": []string{"new-etag"}}, @@ -513,7 +513,7 @@ func TestInvalidUpdate(t *testing.T) { cases := []map[string]interface{}{ nil, make(map[string]interface{}), - map[string]interface{}{"foo": func() {}}, + {"foo": func() {}}, } for _, tc := range cases { if err := testref.Update(context.Background(), tc); err == nil { @@ -542,12 +542,12 @@ func TestTransaction(t *testing.T) { t.Fatal(err) } checkAllRequests(t, mock.Reqs, []*testReq{ - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"X-Firebase-ETag": []string{"true"}}, }, - &testReq{ + { Method: "PUT", Path: "/peter.json", Body: serialize(map[string]interface{}{ @@ -591,12 +591,12 @@ func TestTransactionRetry(t *testing.T) { t.Errorf("Transaction() retries = %d; want = %d", cnt, 2) } checkAllRequests(t, mock.Reqs, []*testReq{ - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"X-Firebase-ETag": []string{"true"}}, }, - &testReq{ + { Method: "PUT", Path: "/peter.json", Body: serialize(map[string]interface{}{ @@ -605,7 +605,7 @@ func TestTransactionRetry(t *testing.T) { }), Header: http.Header{"If-Match": []string{"mock-etag1"}}, }, - &testReq{ + { Method: "PUT", Path: "/peter.json", Body: serialize(map[string]interface{}{ @@ -650,12 +650,12 @@ func TestTransactionError(t *testing.T) { t.Errorf("Transaction() retries = %d; want = %d", cnt, 1) } checkAllRequests(t, mock.Reqs, []*testReq{ - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"X-Firebase-ETag": []string{"true"}}, }, - &testReq{ + { Method: "PUT", Path: "/peter.json", Body: serialize(map[string]interface{}{ @@ -694,7 +694,7 @@ func TestTransactionAbort(t *testing.T) { t.Errorf("Transaction() = nil; want error") } wanted := []*testReq{ - &testReq{ + { Method: "GET", Path: "/peter.json", Header: http.Header{"X-Firebase-ETag": []string{"true"}}, diff --git a/firebase_test.go b/firebase_test.go index bbf1a4c3..4781b378 100644 --- a/firebase_test.go +++ b/firebase_test.go @@ -247,8 +247,8 @@ func TestDatabase(t *testing.T) { func TestDatabaseAuthOverrides(t *testing.T) { cases := []map[string]interface{}{ nil, - map[string]interface{}{}, - map[string]interface{}{"uid": "user1"}, + {}, + {"uid": "user1"}, } for _, tc := range cases { ctx := context.Background() diff --git a/snippets/db.go b/snippets/db.go index 8e0bea71..fc9bd852 100644 --- a/snippets/db.go +++ b/snippets/db.go @@ -153,11 +153,11 @@ func setValue(ctx context.Context, ref *db.Ref) { // [START set_value] usersRef := ref.Child("users") err := usersRef.Set(ctx, map[string]*User{ - "alanisawesome": &User{ + "alanisawesome": { DateOfBirth: "June 23, 1912", FullName: "Alan Turing", }, - "gracehop": &User{ + "gracehop": { DateOfBirth: "December 9, 1906", FullName: "Grace Hopper", },