From d0f649a9b88ce303e5d210c766ce4adcf498c5ed Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Fri, 19 Jun 2026 22:47:10 +0100 Subject: [PATCH] docs(cursor): justify the ignored json.Marshal error in Encode Per the project's error-handling rule, an ignored error needs a comment. Marshalling the two-scalar payload struct cannot fail; document why the error is dropped. No behavior change. --- internal/cursor/cursor.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/cursor/cursor.go b/internal/cursor/cursor.go index fddc90b..846b2bb 100644 --- a/internal/cursor/cursor.go +++ b/internal/cursor/cursor.go @@ -26,6 +26,8 @@ type payload struct { // Encode creates an opaque cursor string from an offset and query hash. func Encode(offset int, queryHash string) string { p := payload{Offset: offset, QueryHash: queryHash} + // Marshalling a struct of two scalar fields (int, string) cannot fail, so the + // error is intentionally ignored. b, _ := json.Marshal(p) return base64.RawURLEncoding.EncodeToString(b) }