Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple token search issue #33

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

nmanoogian
Copy link
Member

In Go, the loop iterator variable is a single variable that takes different values in each loop iteration. When we try to take a reference of the iteration var, its value changes with each iteration. This results in the loop always "finding" the final element. To fix this, we can make a copy of the searchToken variable and take its reference instead.

https://github.com/golang/go/wiki/CommonMistakes#using-reference-to-loop-iterator-variable

Closes ENG-5362
Closes #32

In Go, the loop iterator variable is a single variable that takes different values in each loop iteration.
When we try to take a reference of the iteration var, its value changes with each iteration. This results in the loop always "finding" the final element.
To fix this, we can make a copy of the `searchToken` variable and take its reference instead.

https://github.com/golang/go/wiki/CommonMistakes#using-reference-to-loop-iterator-variable
@nmanoogian nmanoogian requested a review from Piccirello November 3, 2022 19:53
@nmanoogian nmanoogian merged commit 11b67ee into master Nov 4, 2022
@nmanoogian nmanoogian deleted the nic/multiple-service-tokens-access-bugfix branch November 4, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

BUG: When multiple tokens exist for the same config, the returned permission level is incorrect
2 participants