Improve permissions service: caching, nil checks, glob matching
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Context
Follow-up from [PR #7053](https://github.com/Azure/azure-dev/pull/7053) review. Parent tracking issue: #7112
## PR Conversations
- [Cache permission results](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927943744) (@tg-msft)
- [Remove unnecessary nil checks before range](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927966830) (@tg-msft)
- [Use glob matching library](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927991043) (@tg-msft)
## What needs to change
1. **Caching**: Add caching to the permissions service — permissions are unlikely to change during an azd session.
2. **Nil checks**: Remove unnecessary `nil` checks before `range` statements — `range` over a nil slice is a no-op in Go.
3. **Glob matching**: Consider using a glob matching library instead of the custom `wildcardMatch` implementation to avoid maintaining custom logic if assumptions change.
## Files to update
- `cli/azd/pkg/azapi/permissions.go`
Contributor guide
Assessment
This issue has not been assessed yet.