From 1a13c93ba172123a39ee6510033da06a5739541f Mon Sep 17 00:00:00 2001 From: Piotr Piotrowski Date: Fri, 13 Oct 2023 22:44:10 +0200 Subject: [PATCH] Update go mod Signed-off-by: Piotr Piotrowski --- go.mod | 1 + go.sum | 4 ++++ js_test.go | 16 ---------------- nats.go | 22 ---------------------- nats_test.go | 14 -------------- test/kv_test.go | 4 ++-- 6 files changed, 7 insertions(+), 54 deletions(-) diff --git a/go.mod b/go.mod index b103e0790..a0181fa72 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/klauspost/compress v1.17.0 github.com/nats-io/nkeys v0.4.5 github.com/nats-io/nuid v1.0.1 + golang.org/x/text v0.13.0 ) require ( diff --git a/go.sum b/go.sum index 111cfe294..7787524b0 100644 --- a/go.sum +++ b/go.sum @@ -8,3 +8,7 @@ golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/js_test.go b/js_test.go index 754044177..ffbd75db9 100644 --- a/js_test.go +++ b/js_test.go @@ -18,26 +18,10 @@ package nats //////////////////////////////////////////////////////////////////////////////// import ( - "os" "strings" "testing" ) -func createConfFile(t *testing.T, content []byte) string { - t.Helper() - conf, err := os.CreateTemp("", "") - if err != nil { - t.Fatalf("Error creating conf file: %v", err) - } - fName := conf.Name() - conf.Close() - if err := os.WriteFile(fName, content, 0666); err != nil { - os.Remove(fName) - t.Fatalf("Error writing conf file: %v", err) - } - return fName -} - func TestJetStreamConvertDirectMsgResponseToMsg(t *testing.T) { // This test checks the conversion of a "direct get message" response // to a JS message based on the content of specific NATS headers. diff --git a/nats.go b/nats.go index 73709db88..0031dcb65 100644 --- a/nats.go +++ b/nats.go @@ -3077,28 +3077,6 @@ func (nc *Conn) waitForMsgs(s *Subscription) { // Return what is to be used. If we return nil the message will be dropped. type msgFilter func(m *Msg) *Msg -func (nc *Conn) addMsgFilter(subject string, filter msgFilter) { - nc.subsMu.Lock() - defer nc.subsMu.Unlock() - - if nc.filters == nil { - nc.filters = make(map[string]msgFilter) - } - nc.filters[subject] = filter -} - -func (nc *Conn) removeMsgFilter(subject string) { - nc.subsMu.Lock() - defer nc.subsMu.Unlock() - - if nc.filters != nil { - delete(nc.filters, subject) - if len(nc.filters) == 0 { - nc.filters = nil - } - } -} - // processMsg is called by parse and will place the msg on the // appropriate channel/pending queue for processing. If the channel is full, // or the pending queue is over the pending limits, the connection is diff --git a/nats_test.go b/nats_test.go index a69128ca6..7dcdce2cf 100644 --- a/nats_test.go +++ b/nats_test.go @@ -206,20 +206,6 @@ func TestExpandPath(t *testing.T) { } } -//////////////////////////////////////////////////////////////////////////////// -// Reconnect tests -//////////////////////////////////////////////////////////////////////////////// - -const TEST_PORT = 8368 - -var reconnectOpts = Options{ - Url: fmt.Sprintf("nats://127.0.0.1:%d", TEST_PORT), - AllowReconnect: true, - MaxReconnect: 10, - ReconnectWait: 100 * time.Millisecond, - Timeout: DefaultTimeout, -} - //////////////////////////////////////////////////////////////////////////////// // ServerPool tests //////////////////////////////////////////////////////////////////////////////// diff --git a/test/kv_test.go b/test/kv_test.go index 7eafa54ac..afa937de5 100644 --- a/test/kv_test.go +++ b/test/kv_test.go @@ -1154,7 +1154,7 @@ func TestKeyValueNonDirectGet(t *testing.T) { nc, js := jsClient(t, s) defer nc.Close() - kvi, err := js.CreateKeyValue(&nats.KeyValueConfig{Bucket: "TEST"}) + _, err := js.CreateKeyValue(&nats.KeyValueConfig{Bucket: "TEST"}) if err != nil { t.Fatalf("Error creating store: %v", err) } @@ -1171,7 +1171,7 @@ func TestKeyValueNonDirectGet(t *testing.T) { if _, err := js.UpdateStream(&cfg); err != nil { t.Fatalf("Error updating stream: %v", err) } - kvi, err = js.KeyValue("TEST") + kvi, err := js.KeyValue("TEST") if err != nil { t.Fatalf("Error getting kv: %v", err) }