Skip to content

Commit 361aa51

Browse files
chemidyhiranya911
authored andcommitted
remove support go 1.6 (#190)
* remove support go 1.6 * add subtests * fix gofmt * update changelog * fix gofmt
1 parent fe1e7a0 commit 361aa51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+145
-112
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22

3+
- [dropped] Dropped support for Go 1.8 and earlier.
34
- [fixed] Fixing error handling in FCM. The SDK now checks the key
45
`type.googleapis.com/google.firebase.fcm.v1.FcmError` to set error code.
56
- [added] `messaging.ApsAlert` type now supports subtitle in its payload.

auth/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
"google.golang.org/api/option"
2525

26-
"golang.org/x/net/context"
26+
"context"
2727

2828
"firebase.google.com/go/internal"
2929
"google.golang.org/api/identitytoolkit/v3"

auth/auth_appengine.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
package auth
1818

1919
import (
20+
"context"
21+
2022
"firebase.google.com/go/internal"
21-
"golang.org/x/net/context"
2223

2324
"google.golang.org/appengine"
2425
)

auth/auth_std.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
package auth // import "firebase.google.com/go/auth"
1818

1919
import (
20+
"context"
21+
2022
"firebase.google.com/go/internal"
21-
"golang.org/x/net/context"
2223
)
2324

2425
func newCryptoSigner(ctx context.Context, conf *internal.AuthConfig) (cryptoSigner, error) {

auth/auth_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"testing"
2626
"time"
2727

28-
"golang.org/x/net/context"
28+
"context"
2929

3030
"golang.org/x/oauth2/google"
3131

@@ -205,10 +205,12 @@ func TestCustomTokenError(t *testing.T) {
205205
}
206206

207207
for _, tc := range cases {
208-
token, err := client.CustomTokenWithClaims(ctx, tc.uid, tc.claims)
209-
if token != "" || err == nil {
210-
t.Errorf("CustomTokenWithClaims(%q) = (%q, %v); want = (\"\", error)", tc.name, token, err)
211-
}
208+
t.Run(tc.name, func(t *testing.T) {
209+
token, err := client.CustomTokenWithClaims(ctx, tc.uid, tc.claims)
210+
if token != "" || err == nil {
211+
t.Errorf("CustomTokenWithClaims(%q) = (%q, %v); want = (\"\", error)", tc.name, token, err)
212+
}
213+
})
212214
}
213215
}
214216

@@ -321,9 +323,11 @@ func TestVerifyIDTokenError(t *testing.T) {
321323
}
322324

323325
for _, tc := range cases {
324-
if _, err := client.VerifyIDToken(ctx, tc.token); err == nil {
325-
t.Errorf("VerifyIDToken(%q) = nil; want error", tc.name)
326-
}
326+
t.Run(tc.name, func(t *testing.T) {
327+
if _, err := client.VerifyIDToken(ctx, tc.token); err == nil {
328+
t.Errorf("VerifyIDToken(%q) = nil; want error", tc.name)
329+
}
330+
})
327331
}
328332
}
329333

auth/token_generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
"firebase.google.com/go/internal"
3333
"google.golang.org/api/transport"
3434

35-
"golang.org/x/net/context"
35+
"context"
3636
)
3737

3838
type jwtHeader struct {

auth/token_generator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"firebase.google.com/go/internal"
2929
"google.golang.org/api/option"
3030

31-
"golang.org/x/net/context"
31+
"context"
3232
)
3333

3434
func TestEncodeToken(t *testing.T) {

auth/token_verifier.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ import (
3232
"sync"
3333
"time"
3434

35-
"golang.org/x/net/context"
36-
"golang.org/x/net/context/ctxhttp"
35+
"context"
3736
)
3837

3938
// keySource is used to obtain a set of public keys, which can be used to verify cryptographic
@@ -89,7 +88,7 @@ func (k *httpKeySource) refreshKeys(ctx context.Context) error {
8988
return err
9089
}
9190

92-
resp, err := ctxhttp.Do(ctx, k.HTTPClient, req)
91+
resp, err := k.HTTPClient.Do(req.WithContext(ctx))
9392
if err != nil {
9493
return err
9594
}

auth/user_mgt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import (
2424
"strings"
2525
"time"
2626

27+
"context"
28+
2729
"firebase.google.com/go/internal"
28-
"golang.org/x/net/context"
2930

3031
"google.golang.org/api/googleapi"
3132
"google.golang.org/api/identitytoolkit/v3"

auth/user_mgt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"testing"
2828
"time"
2929

30-
"golang.org/x/net/context"
30+
"context"
3131

3232
"firebase.google.com/go/internal"
3333

0 commit comments

Comments
 (0)