From 1423ad4b6b3edbe501d8dc4541388b816d3f673b Mon Sep 17 00:00:00 2001 From: Gustavo Lima Date: Sun, 12 Apr 2026 15:45:42 +0200 Subject: [PATCH] fix(sync): declare sort output channels as receive-only (<-chan) Fixes #835 extsort.New() returns a channel that callers should only receive from; assigning it to a bidirectional (chan) variable is a type mismatch that stricter Go versions surface as a compile error: command/sync.go:372: cannot use extsort.New(...) (value of type <-chan extsort.SortType) as chan extsort.SortType Change srcOutputChan and dstOutputChan declarations from 'chan extsort.SortType' to '<-chan extsort.SortType'. The channels are only ever ranged over (received from), so the narrower type is correct and makes the intent explicit. Reproducer: GOFLAGS=-gcflags=all=-e go build ./command/... # or: upgrade to Go 1.23+ After this change: Builds cleanly on all supported Go versions including 1.23+. --- command/sync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command/sync.go b/command/sync.go index 6dede5a66..7aa08b1b8 100644 --- a/command/sync.go +++ b/command/sync.go @@ -366,7 +366,7 @@ func (s Sync) getSourceAndDestinationObjects(ctx context.Context, cancel context var ( sorter *extsort.SortTypeSorter - srcOutputChan chan extsort.SortType + srcOutputChan <-chan extsort.SortType ) sorter, srcOutputChan, srcErrCh := extsort.New(filteredSrcObjectChannel, storage.FromBytes, storage.Less, extsortConfig) @@ -413,7 +413,7 @@ func (s Sync) getSourceAndDestinationObjects(ctx context.Context, cancel context var ( dstSorter *extsort.SortTypeSorter - dstOutputChan chan extsort.SortType + dstOutputChan <-chan extsort.SortType ) dstSorter, dstOutputChan, dstErrCh := extsort.New(filteredDstObjectChannel, storage.FromBytes, storage.Less, extsortConfig)