Skip to content

Commit

Permalink
refactor: code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushi Sharma committed Dec 24, 2024
1 parent 0ffbd98 commit ae5b295
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/providers/oss/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,26 +468,26 @@ func getPrincipalFromAccountID(accountID, accountType string) (string, error) {
if accountType == AccountTypeRAMUser {
accountIDParts := strings.Split(accountID, "$")
if len(accountIDParts) < 2 {
return "", fmt.Errorf("invalid accountID format")
return "", fmt.Errorf("invalid accountID format: %q", accountID)
}

subParts := strings.Split(accountIDParts[1], ":")
if len(subParts) < 2 {
return "", fmt.Errorf("invalid accountID format")
return "", fmt.Errorf("invalid accountID format: %q", accountID)
}

return subParts[1], nil
} else if accountType == AccountTypeRAMRole {

accountIDParts := strings.Split(accountID, ":")
if len(accountIDParts) < 5 {
return "", fmt.Errorf("invalid accountID format")
return "", fmt.Errorf("invalid accountID format: %q", accountID)
}

mainAccountID := accountIDParts[3]
roleNameParts := strings.Split(accountIDParts[4], "/")

Check failure on line 488 in plugins/providers/oss/provider.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Errorf format %q reads arg #2, but call has 1 arg (govet)

Check failure on line 488 in plugins/providers/oss/provider.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

fmt.Errorf format %q reads arg #2, but call has 1 arg
if len(roleNameParts) < 2 {
return "", fmt.Errorf("invalid accountID format")
return "", fmt.Errorf("invalid accountID format: %q: %q", accountID)

Check failure on line 490 in plugins/providers/oss/provider.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Errorf format %q reads arg #2, but call has 1 arg (govet)

Check failure on line 490 in plugins/providers/oss/provider.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

fmt.Errorf format %q reads arg #2, but call has 1 arg
}

roleName := roleNameParts[1]
Expand Down

0 comments on commit ae5b295

Please sign in to comment.