chore: change interface{} to any (#2818)

* chore: change interface{} to any

* chore: update goctl version to 1.5.0

* chore: update goctl deps
This commit is contained in:
Kevin Wan
2023-01-24 16:32:02 +08:00
committed by GitHub
parent 7e0ac77139
commit ae87114282
221 changed files with 1910 additions and 2207 deletions

View File

@@ -32,7 +32,7 @@ func TestTokenParser(t *testing.T) {
for _, pair := range keys {
req := httptest.NewRequest(http.MethodGet, "http://localhost", http.NoBody)
token, err := buildToken(key, map[string]interface{}{
token, err := buildToken(key, map[string]any{
"key": "value",
}, 3600)
assert.Nil(t, err)
@@ -51,7 +51,7 @@ func TestTokenParser_Expired(t *testing.T) {
prevKey = "B63F477D-BBA3-4E52-96D3-C0034C27694A"
)
req := httptest.NewRequest(http.MethodGet, "http://localhost", http.NoBody)
token, err := buildToken(key, map[string]interface{}{
token, err := buildToken(key, map[string]any{
"key": "value",
}, 3600)
assert.Nil(t, err)
@@ -70,7 +70,7 @@ func TestTokenParser_Expired(t *testing.T) {
assert.Equal(t, "value", tok.Claims.(jwt.MapClaims)["key"])
}
func buildToken(secretKey string, payloads map[string]interface{}, seconds int64) (string, error) {
func buildToken(secretKey string, payloads map[string]any, seconds int64) (string, error) {
now := time.Now().Unix()
claims := make(jwt.MapClaims)
claims["exp"] = now + seconds