From c4c6788bd6cbae12f4965eb2641678a7fe72cf57 Mon Sep 17 00:00:00 2001 From: Haim Rubinstein Date: Sun, 2 Jul 2023 09:27:18 +0300 Subject: [PATCH] make context first parameter --- pkg/stanza/operator/input/udp/udp.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/stanza/operator/input/udp/udp.go b/pkg/stanza/operator/input/udp/udp.go index 8d2e9c5ba56a..a112c843e1c8 100644 --- a/pkg/stanza/operator/input/udp/udp.go +++ b/pkg/stanza/operator/input/udp/udp.go @@ -165,7 +165,7 @@ func (u *Input) goHandleMessages(ctx context.Context) { if u.OneLogPerPacket { log := truncateMaxLog(message) - handleMessage(u, ctx, remoteAddr, log) + handleMessage(ctx, u, remoteAddr, log) continue } @@ -175,7 +175,7 @@ func (u *Input) goHandleMessages(ctx context.Context) { scanner.Split(u.splitFunc) for scanner.Scan() { - handleMessage(u, ctx, remoteAddr, scanner.Bytes()) + handleMessage(ctx, u, remoteAddr, scanner.Bytes()) } if err := scanner.Err(); err != nil { u.Errorw("Scanner error", zap.Error(err)) @@ -197,7 +197,7 @@ func truncateMaxLog(data []byte) (token []byte) { return data } -func handleMessage(u *Input, ctx context.Context, remoteAddr net.Addr, log []byte) { +func handleMessage(ctx context.Context, u *Input, remoteAddr net.Addr, log []byte) { decoded, err := u.encoding.Decode(log) if err != nil { u.Errorw("Failed to decode data", zap.Error(err))