From 4c6b4bc00d3ee1fd40dcf6facc56d7003f1fc30c Mon Sep 17 00:00:00 2001 From: Alex Bozhenko Date: Tue, 17 Dec 2024 16:33:58 -0800 Subject: [PATCH] fix https://github.com/golang/pkgsite/blob/master/internal/godoc/dochtml/deprecated_test.go#L14 Examples of Deprecations: https://pkg.go.dev/net/http#pkg-variables --- jetstream/kv.go | 1 + jetstream/stream_config.go | 1 + jsm.go | 9 +++++++-- kv.go | 1 + nats.go | 5 +++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/jetstream/kv.go b/jetstream/kv.go index 152c7a457..9037c695a 100644 --- a/jetstream/kv.go +++ b/jetstream/kv.go @@ -171,6 +171,7 @@ type ( WatchFiltered(ctx context.Context, keys []string, opts ...WatchOpt) (KeyWatcher, error) // Keys will return all keys. + // // Deprecated: Use ListKeys instead to avoid memory issues. Keys(ctx context.Context, opts ...WatchOpt) ([]string, error) diff --git a/jetstream/stream_config.go b/jetstream/stream_config.go index 304203bc5..3b84d19ea 100644 --- a/jetstream/stream_config.go +++ b/jetstream/stream_config.go @@ -194,6 +194,7 @@ type ( Metadata map[string]string `json:"metadata,omitempty"` // Template identifies the template that manages the Stream. + // // Deprecated: This feature is no longer supported. Template string `json:"template_owner,omitempty"` } diff --git a/jsm.go b/jsm.go index 2ae19c7a3..dc46441fa 100644 --- a/jsm.go +++ b/jsm.go @@ -41,6 +41,7 @@ type JetStreamManager interface { PurgeStream(name string, opts ...JSOpt) error // StreamsInfo can be used to retrieve a list of StreamInfo objects. + // // Deprecated: Use Streams() instead. StreamsInfo(opts ...JSOpt) <-chan *StreamInfo @@ -86,6 +87,7 @@ type JetStreamManager interface { ConsumerInfo(stream, name string, opts ...JSOpt) (*ConsumerInfo, error) // ConsumersInfo is used to retrieve a list of ConsumerInfo objects. + // // Deprecated: Use Consumers() instead. ConsumersInfo(stream string, opts ...JSOpt) <-chan *ConsumerInfo @@ -240,8 +242,9 @@ type StreamConfig struct { // v2.10.0 or later. Metadata map[string]string `json:"metadata,omitempty"` - // Template identifies the template that manages the Stream. Deprecated: - // This feature is no longer supported. + // Template identifies the template that manages the Stream. + // + // Deprecated: This feature is no longer supported. Template string `json:"template_owner,omitempty"` } @@ -747,6 +750,7 @@ func (jsc *js) Consumers(stream string, opts ...JSOpt) <-chan *ConsumerInfo { } // ConsumersInfo is used to retrieve a list of ConsumerInfo objects. +// // Deprecated: Use Consumers() instead. func (jsc *js) ConsumersInfo(stream string, opts ...JSOpt) <-chan *ConsumerInfo { return jsc.Consumers(stream, opts...) @@ -1617,6 +1621,7 @@ func (jsc *js) Streams(opts ...JSOpt) <-chan *StreamInfo { } // StreamsInfo can be used to retrieve a list of StreamInfo objects. +// // Deprecated: Use Streams() instead. func (jsc *js) StreamsInfo(opts ...JSOpt) <-chan *StreamInfo { return jsc.Streams(opts...) diff --git a/kv.go b/kv.go index bcb283ff8..0a850e57b 100644 --- a/kv.go +++ b/kv.go @@ -69,6 +69,7 @@ type KeyValue interface { // argument. It can be configured with the same options as Watch. WatchFiltered(keys []string, opts ...WatchOpt) (KeyWatcher, error) // Keys will return all keys. + // // Deprecated: Use ListKeys instead to avoid memory issues. Keys(opts ...WatchOpt) ([]string, error) // ListKeys will return all keys in a channel. diff --git a/nats.go b/nats.go index 0240fc54d..aeebb6283 100644 --- a/nats.go +++ b/nats.go @@ -395,6 +395,7 @@ type Options struct { // DisconnectedCB sets the disconnected handler that is called // whenever the connection is disconnected. // Will not be called if DisconnectedErrCB is set + // // Deprecated. Use DisconnectedErrCB which passes error that caused // the disconnect event. DisconnectedCB ConnHandler @@ -462,6 +463,7 @@ type Options struct { TokenHandler AuthTokenHandler // Dialer allows a custom net.Dialer when forming connections. + // // Deprecated: should use CustomDialer instead. Dialer *net.Dialer @@ -1127,6 +1129,7 @@ func DisconnectErrHandler(cb ConnErrHandler) Option { } // DisconnectHandler is an Option to set the disconnected handler. +// // Deprecated: Use DisconnectErrHandler. func DisconnectHandler(cb ConnHandler) Option { return func(o *Options) error { @@ -1306,6 +1309,7 @@ func SyncQueueLen(max int) Option { // Dialer is an Option to set the dialer which will be used when // attempting to establish a connection. +// // Deprecated: Should use CustomDialer instead. func Dialer(dialer *net.Dialer) Option { return func(o *Options) error { @@ -1430,6 +1434,7 @@ func TLSHandshakeFirst() Option { // Handler processing // SetDisconnectHandler will set the disconnect event handler. +// // Deprecated: Use SetDisconnectErrHandler func (nc *Conn) SetDisconnectHandler(dcb ConnHandler) { if nc == nil {