Conversation
- Remove unnecessary IIFE closure from convertStringToPermissionScope; since the 'all' case now returns '' directly, the surrounding func()() wrapper and the redundant 'key != all' post-check are no longer needed. - Replace manual collect-keys/sort.Strings/iterate loop in compiler_activation_jobs.go with the idiomatic slices.Sorted(maps.Keys(...)) one-liner; both packages were already imported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Pull request created: #17966 |
pelikhan
approved these changes
Feb 23, 2026
|
تم
في الاثنين، ٢٣ فبراير ٢٠٢٦، ١٩:٠٥ Peli de Halleux ***@***.***>
كتب:
… ***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#17966 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B2DFN3SN4KOVRL4DRAEBA7T4NNFQ5AVCNFSM6AAAAACV5C6W4OVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTQNBSHE3TIMJYHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR applies two targeted simplifications to code modified in the last 24 hours, improving clarity while preserving identical functionality.
Files Simplified
pkg/workflow/permissions.go— Remove unnecessary IIFE closure fromconvertStringToPermissionScopepkg/workflow/compiler_activation_jobs.go— Replace manual key-collect/sort/iterate with idiomaticslices.Sorted(maps.Keys(...))Improvements Made
1.
permissions.go— Eliminate IIFE anti-pattern (from PR #17951)Before the
"all"case was added explicitly to the switch, the function used an immediately-invoked function closure to capture the scope and then performed a redundant post-check:Now that
"all"is handled directly in the switch, the IIFE wrapper and thekey != "all"guard are redundant. The simplified version logs in thedefaultbranch and returns early — idiomatic Go:2.
compiler_activation_jobs.go— Useslices.Sorted(maps.Keys(...))(from PR #17927)The PR introduced a manual 4-line pattern to iterate over map keys in sorted order. Since both
mapsandslicesare already imported, this collapses to a one-liner:This also removes the now-unused
"sort"import.Changes Based On
allmeta-key in scope converter #17951 — Add missing permission scopes to schema and handleallmeta-key in scope converterTesting
sortimport cleanly removed fromcompiler_activation_jobs.goReview Focus
convertStringToPermissionScopestill returns""silently for"all"and logs + returns""for unknown keysslices.Sorted(maps.Keys(data.Jobs))produces the same deterministic order as the previoussort.StringspatternReferences:
Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.org