refactor: complete removal of go-linq/x/exp, modernize Go syntax#27
Merged
AWaterColorPen merged 2 commits intomainfrom Apr 10, 2026
Merged
refactor: complete removal of go-linq/x/exp, modernize Go syntax#27AWaterColorPen merged 2 commits intomainfrom
AWaterColorPen merged 2 commits intomainfrom
Conversation
- Remove all remaining go-linq usage in server.go, server_policy.go, server_user_domain.go, server_user_role.go - Replace linq.Distinct with stdlib-based distinct() generic helper - Replace golang.org/x/exp/constraints.Ordered with cmp.Ordered in Diff() - Replace sort.Slice with slices.SortFunc in EdgeSorter methods - Remove go-linq and golang.org/x/exp from go.mod (run go mod tidy) - Add BFS comments on all growing-queue for-loops for clarity - Fix getSourceFeatureG2: initialize queue with DefaultFeatureRootName (previous implementation had an empty queue bug) - All existing tests pass Part of Phase 1 modernization plan.
AWaterColorPen
commented
Apr 6, 2026
Owner
Author
AWaterColorPen
left a comment
There was a problem hiding this comment.
AI Review — LGTM ✅
Clean modernization of the dependency removal. A few observations:
Strengths:
Diff[T]now uses explicit map lookups instead of go-linq reflection — clearer semantics and better performance.LeafFirstSortreversal viacmp.Compare(e[b.V], e[a.V])is correct (note: reversedb, ato achieve descending order).distinct[T]defined ininheritance.gois a well-written generic helper, consistently reused inserver_policy.go,server_user_domain.go, andserver_user_role.go.- BFS comments added in
object_directory.go,server_check.go, andserver_feature_reset.go— good readability improvement. go-linqandgolang.org/x/expfully removed fromgo.mod/go.sum. ✅- CI passes. ✅
Minor note:
The server_policy.go diff has a stray blank line after package caskin (empty import block left behind). Not a blocker but worth a quick cleanup.
Ready to merge once you are happy with it.
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.
Summary
Completes the removal of legacy dependencies started in the previous PR, and modernizes Go syntax throughout the codebase.
Changes
Dependency removal:
go-linqusage inserver.go,server_policy.go,server_user_domain.go,server_user_role.gogolang.org/x/exp/constraints.Orderedwith stdlibcmp.OrderedinDiff()go-linqandgolang.org/x/expfully removed fromgo.modaftergo mod tidyStdlib replacements:
linq.Distinct→ stdlib-baseddistinct()generic helper (already ininheritance.go)sort.Slice→slices.SortFuncinEdgeSorter.RootFirstSortandLeafFirstSortDiffPolicykey map changed frommap[any]*Policytomap[string]*Policy(type-safe)Bug fix:
getSourceFeatureG2: initialize BFS queue withDefaultFeatureRootName(was empty before)Readability:
// BFS:comments on growing-queue for-loops explaining the patternSpec:
Test results
Part of Phase 1 modernization plan.