From 439ee11a5d2a05ed2f6725b0c6b64039881db951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Wed, 22 Feb 2023 21:53:51 +0100 Subject: [PATCH 1/2] doc: fix formatting of Deprecated notices Add an empty comment line before "Deprecated:" notices in Go documentation to follow the convention defined in https://github.com/golang/go/wiki/Deprecated This will allow tooling to inform developers about use of those deprecated APIs. --- channel.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channel.go b/channel.go index e5af2504..0cc85d07 100644 --- a/channel.go +++ b/channel.go @@ -213,6 +213,7 @@ func Buffer[T any](ch <-chan T, size int) (collection []T, length int, readTime } // Buffer creates a slice of n elements from a channel. Returns the slice and the slice length. +// // Deprecated: Use lo.Buffer instead. func Batch[T any](ch <-chan T, size int) (collection []T, length int, readTime time.Duration, ok bool) { return Buffer(ch, size) @@ -246,6 +247,7 @@ func BufferWithTimeout[T any](ch <-chan T, size int, timeout time.Duration) (col } // BufferWithTimeout creates a slice of n elements from a channel, with timeout. Returns the slice and the slice length. +// // Deprecated: Use lo.BufferWithTimeout instead. func BatchWithTimeout[T any](ch <-chan T, size int, timeout time.Duration) (collection []T, length int, readTime time.Duration, ok bool) { return BufferWithTimeout(ch, size, timeout) @@ -278,6 +280,7 @@ func FanIn[T any](channelBufferCap int, upstreams ...<-chan T) <-chan T { // ChannelMerge collects messages from multiple input channels into a single buffered channel. // Output messages has no priority. When all upstream channels reach EOF, downstream channel closes. +// // Deprecated: Use lo.FanIn instead. func ChannelMerge[T any](channelBufferCap int, upstreams ...<-chan T) <-chan T { return FanIn(channelBufferCap, upstreams...) From 34ad3da0f1f43d5ba6584b9d0c5bcc1be7e083b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Wed, 22 Feb 2023 22:00:57 +0100 Subject: [PATCH 2/2] doc: add doc links on Deprecated notices Add doc links in deprecation notices mentionned in Go doc comments. About doc links: https://go.dev/doc/comment#doclinks --- channel.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/channel.go b/channel.go index 0cc85d07..497bd027 100644 --- a/channel.go +++ b/channel.go @@ -214,7 +214,7 @@ func Buffer[T any](ch <-chan T, size int) (collection []T, length int, readTime // Buffer creates a slice of n elements from a channel. Returns the slice and the slice length. // -// Deprecated: Use lo.Buffer instead. +// Deprecated: Use [Buffer] instead. func Batch[T any](ch <-chan T, size int) (collection []T, length int, readTime time.Duration, ok bool) { return Buffer(ch, size) } @@ -248,7 +248,7 @@ func BufferWithTimeout[T any](ch <-chan T, size int, timeout time.Duration) (col // BufferWithTimeout creates a slice of n elements from a channel, with timeout. Returns the slice and the slice length. // -// Deprecated: Use lo.BufferWithTimeout instead. +// Deprecated: Use [BufferWithTimeout] instead. func BatchWithTimeout[T any](ch <-chan T, size int, timeout time.Duration) (collection []T, length int, readTime time.Duration, ok bool) { return BufferWithTimeout(ch, size, timeout) } @@ -281,7 +281,7 @@ func FanIn[T any](channelBufferCap int, upstreams ...<-chan T) <-chan T { // ChannelMerge collects messages from multiple input channels into a single buffered channel. // Output messages has no priority. When all upstream channels reach EOF, downstream channel closes. // -// Deprecated: Use lo.FanIn instead. +// Deprecated: Use [FanIn] instead. func ChannelMerge[T any](channelBufferCap int, upstreams ...<-chan T) <-chan T { return FanIn(channelBufferCap, upstreams...) }