Browse Source

Typos: use %w for errors in fmt.Errorf.

Frederic G. MARAND 1 year ago
parent
commit
0e28501a85
1 changed files with 2 additions and 2 deletions
  1. 2 2
      consumer.go

+ 2 - 2
consumer.go

@@ -72,7 +72,7 @@ func consumer(ctx context.Context, w io.Writer, enc *json.Encoder, client *sqs.C
 	for {
 		recv, err := client.ReceiveMessage(ctx, &rmi)
 		if err != nil {
-			return fmt.Errorf("failed receiving from queue: %v, aborting", err)
+			return fmt.Errorf("failed receiving from queue: %w, aborting", err)
 		}
 		if len(recv.Messages) == 0 {
 			fmt.Fprintf(w, "No message with %d seconds timeout\n", rmi.WaitTimeSeconds)
@@ -132,7 +132,7 @@ func validateMessage(msg message) (*Event, error) {
 	}
 	evt.MessageID, err = uuid.Parse(*msg.MessageId)
 	if err != nil {
-		return nil, fmt.Errorf("error parsing MessageId as a UUID: %v", err)
+		return nil, fmt.Errorf("error parsing MessageId as a UUID: %w", err)
 	}
 	if msg.MD5OfBody == nil {
 		return nil, fmt.Errorf("error: MD5OfBody is nil")