From c642319514372928445f7af4ac3f33a60fdce265 Mon Sep 17 00:00:00 2001
From: Joachim Bauch <bauch@struktur.de>
Date: Mon, 11 Nov 2024 10:20:34 +0100
Subject: [PATCH] Don't redefine built-in id "max".

---
 natsclient_test.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/natsclient_test.go b/natsclient_test.go
index a28a0c7..430ef6d 100644
--- a/natsclient_test.go
+++ b/natsclient_test.go
@@ -64,7 +64,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
 	ch := make(chan struct{})
 
 	var received atomic.Int32
-	max := int32(20)
+	maxPublish := int32(20)
 	ready := make(chan struct{})
 	quit := make(chan struct{})
 	defer close(quit)
@@ -74,7 +74,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
 			select {
 			case <-dest:
 				total := received.Add(1)
-				if total == max {
+				if total == maxPublish {
 					if err := sub.Unsubscribe(); !assert.NoError(err) {
 						return
 					}
@@ -86,7 +86,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
 		}
 	}()
 	<-ready
-	for i := int32(0); i < max; i++ {
+	for i := int32(0); i < maxPublish; i++ {
 		assert.NoError(client.Publish("foo", []byte("hello")))
 
 		// Allow NATS goroutines to process messages.
@@ -94,7 +94,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
 	}
 	<-ch
 
-	require.EqualValues(max, received.Load(), "Received wrong # of messages")
+	require.EqualValues(maxPublish, received.Load(), "Received wrong # of messages")
 }
 
 func TestNatsClient_Subscribe(t *testing.T) {