fix gopls lintings

This commit is contained in:
dhax 2025-03-05 15:41:29 +01:00
parent a2e2ba39f9
commit dd2412463b
7 changed files with 19 additions and 25 deletions

View file

@ -20,7 +20,7 @@ type AppClaims struct {
}
// ParseClaims parses JWT claims into AppClaims.
func (c *AppClaims) ParseClaims(claims map[string]interface{}) error {
func (c *AppClaims) ParseClaims(claims map[string]any) error {
id, ok := claims["id"]
if !ok {
return errors.New("could not parse claim id")
@ -40,7 +40,7 @@ func (c *AppClaims) ParseClaims(claims map[string]interface{}) error {
var roles []string
if rl != nil {
for _, v := range rl.([]interface{}) {
for _, v := range rl.([]any) {
roles = append(roles, v.(string))
}
}
@ -57,7 +57,7 @@ type RefreshClaims struct {
}
// ParseClaims parses the JWT claims into RefreshClaims.
func (c *RefreshClaims) ParseClaims(claims map[string]interface{}) error {
func (c *RefreshClaims) ParseClaims(claims map[string]any) error {
token, ok := claims["token"]
if !ok {
return errors.New("could not parse claim token")

View file

@ -65,8 +65,8 @@ func (a *TokenAuth) CreateJWT(c AppClaims) (string, error) {
return tokenString, err
}
func ParseStructToMap(c interface{}) (map[string]interface{}, error) {
var claims map[string]interface{}
func ParseStructToMap(c any) (map[string]any, error) {
var claims map[string]any
inrec, _ := json.Marshal(c)
err := json.Unmarshal(inrec, &claims)
if err != nil {