Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HomayoonAlimohammadi committed Oct 9, 2024
1 parent 1572fb1 commit c94ccf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func getSecret(ctx context.Context, c client.Client, clusterKey client.ObjectKey
func generateAndStore(ctx context.Context, c client.Client, clusterKey client.ObjectKey) (*corev1.Secret, error) {
token, err := randomB64(16)
if err != nil {
return nil, fmt.Errorf("failed to generate token: %v", err)
return nil, fmt.Errorf("failed to generate token: %w", err)
}

secret := &corev1.Secret{
Expand All @@ -82,7 +82,7 @@ func generateAndStore(ctx context.Context, c client.Client, clusterKey client.Ob
}

if err := c.Create(ctx, secret); err != nil {
return nil, fmt.Errorf("failed to create secret: %v", err)
return nil, fmt.Errorf("failed to create secret: %w", err)
}

return secret, nil
Expand All @@ -93,7 +93,7 @@ func randomB64(n int) (string, error) {
b := make([]byte, n)
_, err := cryptorand.Read(b)
if err != nil {
return "", fmt.Errorf("failed to read random bytes: %v", err)
return "", fmt.Errorf("failed to read random bytes: %w", err)
}
return base64.StdEncoding.EncodeToString(b), nil
}

0 comments on commit c94ccf3

Please sign in to comment.