modernize code with slices and maps packages - #7268
Open
thaJeztah wants to merge 8 commits into
Open
Conversation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Member
Author
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
docker-agent
reviewed
Sep 1, 2026
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
⚠️ Review incomplete
chunk 1: Drafter did not complete (schema validation error prevented drafter agent delegation; direct analysis by orchestrator was performed instead across all 20 changed production files)
Findings so far:
Orchestrator direct analysis summary:
This PR replaces sort, strings.HasPrefix, manual key-collection loops, and similar patterns with idiomatic slices/maps package equivalents. All replacements reviewed appear semantically equivalent:
slices.Sort/slices.SortFunc— correct replacements forsort.Strings/sort.Sliceslices.Sorted(maps.Keys(...))— deterministically sorted, equivalent to collect-then-sort patternslices.Min(keys)— equivalent tosort.Strings(keys); keys[0]slices.Concat(...)— equivalent toappend(head, tail...)slices.SortedFunc(maps.Values(...), ...)— correct forUlimitOpt.GetList; stable vs. unstable irrelevant since ulimit names are unique map keysfilepath.IsLocalpath check inconfig.go— more robust thanstrings.HasPrefix; correctly rejects traversal paths%s→%vintoStringList— only affects nil values whenallowNil=true; sole caller usesallowNil=falseso no behavioral change- Nil-mutation fix in
trust/common.goandtrust/formatter.go— old code mutated the receiver's slice viasort.Strings; new code sorts a copy, which is an improvement
No bugs found in the changed production code.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use filepath.Rel and filepath.IsLocal instead of comparing path prefixes as strings when checking that a path stays within the config directory. Also avoid calling Dir multiple times when constructing and validating the path. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
force-pushed
the
slice_and_dice
branch
from
September 1, 2026 19:52
ca28acd to
d79e0e8
Compare
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.
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)