Skip to content

Commit

Permalink
Merge pull request #1381 from paoloteti/typos
Browse files Browse the repository at this point in the history
[FIXED] typos in comments and error messages
  • Loading branch information
wallyqs committed Aug 28, 2023
2 parents ac8a43f + 6b9c745 commit 9a626e4
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions jetstream/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ for s := range streams.Info() {
fmt.Println(s.Config.Name)
}
if streams.Err() != nil {
fmt.Println("Unexpected error ocurred")
fmt.Println("Unexpected error occurred")
}

// list stream names
Expand All @@ -187,7 +187,7 @@ for name := range names.Name() {
fmt.Println(name)
}
if names.Err() != nil {
fmt.Println("Unexpected error ocurred")
fmt.Println("Unexpected error occurred")
}
```

Expand Down Expand Up @@ -314,7 +314,7 @@ for cons := range consumers.Info() {
fmt.Println(cons.Name)
}
if consumers.Err() != nil {
fmt.Println("Unexpected error ocurred")
fmt.Println("Unexpected error occurred")
}

// list consumer names
Expand All @@ -323,7 +323,7 @@ for name := range names.Name() {
fmt.Println(name)
}
if names.Err() != nil {
fmt.Println("Unexpected error ocurred")
fmt.Println("Unexpected error occurred")
}
```

Expand Down Expand Up @@ -579,7 +579,7 @@ case err := <-ackF.Err():
fmt.Println(err)
}

// similarly to syncronous publish, there is a helper method accepting subject and data
// similarly to synchronous publish, there is a helper method accepting subject and data
ackF, err = js.PublishAsync("ORDERS.new", []byte("hello"))
```

Expand Down
2 changes: 1 addition & 1 deletion jetstream/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type (
// Consumer contains methods for fetching/processing messages from a stream, as well as fetching consumer info
Consumer interface {
// Fetch is used to retrieve up to a provided number of messages from a stream.
// This method will always send a single request and wait until either all messages are retreived
// This method will always send a single request and wait until either all messages are retrieved
// or request times out.
Fetch(batch int, opts ...FetchOpt) (MessageBatch, error)
// FetchBytes is used to retrieve up to a provided bytes from the stream.
Expand Down
2 changes: 1 addition & 1 deletion jetstream/ordered.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (s *orderedSubscription) Stop() {
}

// Fetch is used to retrieve up to a provided number of messages from a stream.
// This method will always send a single request and wait until either all messages are retreived
// This method will always send a single request and wait until either all messages are retrieved
// or context reaches its deadline.
func (c *orderedConsumer) Fetch(batch int, opts ...FetchOpt) (MessageBatch, error) {
if c.consumerType == consumerTypeConsume {
Expand Down
2 changes: 1 addition & 1 deletion jetstream/test/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestMessageDetails(t *testing.T) {
t.Fatalf("unexpected error during fetch: %v", err)
}
if string(msg.Data()) != "msg" {
t.Fatalf("Invalid messge body; want: 'msg'; got: %q", string(msg.Data()))
t.Fatalf("Invalid message body; want: 'msg'; got: %q", string(msg.Data()))
}
metadata, err := msg.Metadata()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion jetstream/test/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ func TestPublishMsgAsync(t *testing.T) {
t.Fatalf("Invalid headers on message; want: %v; got: %v", pub.expectedHeaders, pub.msg.Header)
}
if string(msg.Data) != string(pub.msg.Data) {
t.Fatalf("Invaid message in ack; want: %q; got: %q", string(pub.msg.Data), string(msg.Data))
t.Fatalf("Invalid message in ack; want: %q; got: %q", string(pub.msg.Data), string(msg.Data))
}
case err := <-ackFuture.Err():
if pub.withAckError == nil {
Expand Down
4 changes: 2 additions & 2 deletions js.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func DirectGetNext(subject string) JSOpt {
}

// StreamListFilter is an option that can be used to configure `StreamsInfo()` and `StreamNames()` requests.
// It allows filtering the retured streams by subject associated with each stream.
// It allows filtering the returned streams by subject associated with each stream.
// Wildcards can be used. For example, `StreamListFilter(FOO.*.A) will return
// all streams which have at least one subject matching the provided pattern (e.g. FOO.TEST.A).
func StreamListFilter(subject string) JSOpt {
Expand Down Expand Up @@ -3362,7 +3362,7 @@ func (p AckPolicy) MarshalJSON() ([]byte, error) {
case AckExplicitPolicy:
return json.Marshal("explicit")
default:
return nil, fmt.Errorf("nats: unknown acknowlegement policy %v", p)
return nil, fmt.Errorf("nats: unknown acknowledgement policy %v", p)
}
}

Expand Down
2 changes: 1 addition & 1 deletion nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,7 @@ func TestCustomInboxPrefix(t *testing.T) {
for _, p := range []string{"$BOB.", "$BOB.*", "$BOB.>", ">", ".", "", "BOB.*.X", "BOB.>.X"} {
err := CustomInboxPrefix(p)(opts)
if err == nil {
t.Fatalf("Expeted error for %q", p)
t.Fatalf("Expected error for %q", p)
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ func TestReceiveInfoWithEmptyConnectURLs(t *testing.T) {
// The processing of PONG in sendConnect() should leave the
// rest for the readLoop to process.
c.Write([]byte("PONG\r\nINFO {\"server_id\":\"server1\",\"connect_urls\":[\"127.0.0.1:4222\", \"127.0.0.1:4223\", \"127.0.0.1:4224\"]}\r\n"))
// Wait for the notication
// Wait for the notification
<-ch
// Close the connection in our side and go back into accept
c.Close()
Expand Down
2 changes: 1 addition & 1 deletion test/drain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func TestDrainConnection(t *testing.T) {
expected := int32(50)
sleep := 10 * time.Millisecond

// Create the listner for responses on "bar"
// Create the listener for responses on "bar"
_, err = nc2.Subscribe("bar", func(_ *nats.Msg) {
r := atomic.AddInt32(&responses, 1)
if r == expected {
Expand Down
8 changes: 4 additions & 4 deletions test/js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@ func TestAccountInfo(t *testing.T) {
}

if !reflect.DeepEqual(test.expected, info) {
t.Fatalf("Accoount info does not match; expected: %v; got: %v", test.expected, info)
t.Fatalf("Account info does not match; expected: %v; got: %v", test.expected, info)
}
_, err = js.AddStream(&nats.StreamConfig{Name: "FOO", MaxBytes: 1024})
if err != nil {
Expand All @@ -2749,7 +2749,7 @@ func TestAccountInfo(t *testing.T) {
}

if !reflect.DeepEqual(test.expected, info) {
t.Fatalf("Accoount info does not match; expected: %v; got: %v", test.expected, info)
t.Fatalf("Account info does not match; expected: %v; got: %v", test.expected, info)
}
})
}
Expand Down Expand Up @@ -4109,7 +4109,7 @@ func TestJetStreamSubscribe_DeliverPolicy(t *testing.T) {
t.Fatalf("Error on next msg: %v", err)
}
if string(msg.Data) != "bar msg 2" {
t.Fatalf("Unexepcted last message: %q", msg.Data)
t.Fatalf("Unexpected last message: %q", msg.Data)
}
}

Expand Down Expand Up @@ -7869,7 +7869,7 @@ func TestJetStreamDomain(t *testing.T) {
}
}

// Test that we properly enfore per subject msg limits.
// Test that we properly enforce per subject msg limits.
func TestJetStreamMaxMsgsPerSubject(t *testing.T) {
const subjectMax = 5
msc := nats.StreamConfig{
Expand Down
2 changes: 1 addition & 1 deletion test/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestObjectBasics(t *testing.T) {
status, err := obs.Status()
expectOk(t, err)
if !status.Sealed() {
t.Fatalf("exected sealed status")
t.Fatalf("expected sealed status")
}
if status.Size() == 0 {
t.Fatalf("size is 0")
Expand Down

0 comments on commit 9a626e4

Please sign in to comment.