Skip to content

Commit

Permalink
reduce mapaccess
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespook committed Sep 8, 2016
1 parent b4e4f08 commit 7101142
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ func dfs(rbac *RBAC, id string, skipped map[string]struct{}, stack []string) err
return ErrFoundCircle
}
}
if len(rbac.parents[id]) == 0 {
parents := rbac.parents[id]
if len(parents) == 0 {
stack = nil
skipped[id] = empty
return nil
}
stack = append(stack, id)
for pid := range rbac.parents[id] {
for pid := range parents {
if err := dfs(rbac, pid, skipped, stack); err != nil {
return err
}
Expand Down

0 comments on commit 7101142

Please sign in to comment.