Skip to content

Commit acd5b54

Browse files
committed
Remove unnecessary GetUser() in GetManagedPoliciesForUser()
(cherry picked from commit 4cee134)
1 parent 551356d commit acd5b54

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

pkg/lib/aws/iam.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ func (c *Client) GetGroupsForUser(userName string) ([]iam.Group, error) {
5151
}
5252

5353
func (c *Client) GetManagedPoliciesForUser(userName string) ([]iam.AttachedPolicy, error) {
54-
user, err := c.GetUser()
55-
if err != nil {
56-
return nil, err
57-
}
58-
5954
var policies []iam.AttachedPolicy
6055

6156
userManagedPolicies, err := c.IAM().ListAttachedUserPolicies(&iam.ListAttachedUserPoliciesInput{
@@ -68,7 +63,7 @@ func (c *Client) GetManagedPoliciesForUser(userName string) ([]iam.AttachedPolic
6863
policies = append(policies, *policy)
6964
}
7065

71-
groups, err := c.GetGroupsForUser(*user.UserName)
66+
groups, err := c.GetGroupsForUser(userName)
7267
if err != nil {
7368
return nil, err
7469
}

0 commit comments

Comments
 (0)