- Notifications
You must be signed in to change notification settings - Fork1k
Commitefb80b5
committed
feat: generate typed ScopeName constants from RBAC permissions
Add build-time generation of typed Go constants for all RBAC scopenames to improve type safety and prevent typos when referencingscopes in code.- Add scopenames.gotmpl template for generating ScopeName constants- Extend scripts/typegen/main.go to support "scopenames" template- Generate coderd/rbac/scopes_constants_gen.go with all typed constants- Update Makefile to include generated file in build targets- Constants follow pattern Scope<Resource><Action> = "resource:action"1 parent1d5d9f1 commitefb80b5
File tree
4 files changed
+186
-0
lines changed- coderd/rbac
- scripts/typegen
4 files changed
+186
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
645 | 645 |
| |
646 | 646 |
| |
647 | 647 |
| |
| 648 | + | |
648 | 649 |
| |
649 | 650 |
| |
650 | 651 |
| |
| |||
693 | 694 |
| |
694 | 695 |
| |
695 | 696 |
| |
| 697 | + | |
696 | 698 |
| |
697 | 699 |
| |
698 | 700 |
| |
| |||
832 | 834 |
| |
833 | 835 |
| |
834 | 836 |
| |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
835 | 842 |
| |
836 | 843 |
| |
837 | 844 |
| |
|
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 |
| |
35 | 38 |
| |
36 | 39 |
| |
| |||
96 | 99 |
| |
97 | 100 |
| |
98 | 101 |
| |
| 102 | + | |
| 103 | + | |
99 | 104 |
| |
100 | 105 |
| |
101 | 106 |
| |
| |||
225 | 230 |
| |
226 | 231 |
| |
227 | 232 |
| |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
228 | 242 |
| |
229 | 243 |
| |
230 | 244 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + |
0 commit comments
Comments
(0)