Conversation
…ents Follow-up polish to the merged Gthulhu#17. No behavior change. Replace the hand-written applied-set copy in GetChangedStrategies with maps.Clone, use for range in the concurrency test, and shorten the strategyMap/appliedStrategyMap field comment so it is not longer than the two fields it documents. gofmt -s, go vet and go test -race are clean. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
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.
What does this PR change?
Follow-up to #17, no behavior change. In
GetChangedStrategiesthe applied set is rebuilt at the end of each drain. It used a manualmakeplus a copy loop, now it ismaps.Clone(g.strategyMap)which does the same thing. The concurrency test usesfor rangeinstead offor i := 0; i < n; i++, and I shortened the comment on thestrategyMap/appliedStrategyMapfields so it is not longer than the two fields it describes.Why is this change needed?
Same reason as the api side follow-up: after #17 merged I read my own code again against modern Go and the comment style this repo prefers. The module targets Go 1.22, so
maps.Cloneis available and reads better than the hand written copy. The coalescing logic is untouched.Follow-up to #17.
How was it tested?
On Linux:
gofmt -s -lon the two files is cleango vet ./plugin/gthulhu/...passesgo test -race ./plugin/gthulhu/...passes, so the concurrency test still guards the write lock under the race detectorContributor checklist
Scheduling / eBPF changes
N/A. User space plugin code only.