Return a sorter from NewSorter - #2112
Merged
henry118 merged 1 commit intoOct 1, 2026
Merged
Conversation
NewSorter returns nil, so the only way an outside caller can reach the
sorter hands back a nil Transformer and the first Transform call panics.
Everything else in the file is implemented, sorter satisfies Transformer
(the assertion right above says so), NewSimplifier composes sorter{}
directly and the tests construct sorter{} directly, so nothing in the tree
goes through the constructor and nothing caught it.
Return sorter{}, and cover the constructor.
Signed-off-by: Dmitry Voropaev <dy.voropaev@gmail.com>
v0ropaev
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
September 28, 2026 19:14
Member
|
@v0ropaev thanks for the patch. please cryptographically sign the commit. and i'll trigger the CI once it's done. thanks |
v0ropaev
force-pushed
the
fix/new-sorter-returns-a-transformer
branch
from
October 1, 2026 21:24
f57b76f to
0aabe0b
Compare
Contributor
Author
|
Done, the commit is signed and GitHub marks it verified. Ready for CI whenever you want to kick it off. |
Member
|
/ok to test 0aabe0b |
Coverage Report for CI Build 36928530525Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.02%) to 44.622%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
henry118
approved these changes
Oct 1, 2026
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.
Description
transform.NewSorter()returnsnil:pkg/is public, and the constructor is the only way to reachsorterfrom outside the package, so an external caller gets a nilTransformerand panics on the firstTransformcall.Nothing in the tree notices.
NewSimplifiercomposessorter{}directly (simplify.go:31-37), andsorter_test.goconstructssorter{}directly in all three of its tests, so the constructor has no caller anywhere in the repo.grep -rn NewSorteroutsidevendor/returns only its own definition and doc comment.This has been there since the file was added in #1784.
Checklist
make test)make lint) — golangci-lint is not installed here;gofmt -s -lon the package is cleanTesting
TestNewSorterReturnsAUsableTransformerasserts the constructor gives something non-nil and that it actually sorts: two devices out of order in,gpu0beforegpu1out. On current main it fails at the nil check, which is the panic an outside caller would hit.darwin/arm64, Go 1.27.1, no GPU.