From 31faf77fcc481f120253e5bb0d23a3c64ce2aa0a Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 4 Jun 2026 11:17:08 +0800 Subject: [PATCH] style: add doc comments for exported hash and utils functions Fix revive lint warnings for FNV64a, FNV64aBytes, BytesContainsFold. --- internal/hash/hash.go | 2 ++ internal/utils/bytes.go | 1 + 2 files changed, 3 insertions(+) diff --git a/internal/hash/hash.go b/internal/hash/hash.go index 55316c1..9a40e71 100644 --- a/internal/hash/hash.go +++ b/internal/hash/hash.go @@ -1,5 +1,6 @@ package hash +// FNV64a computes FNV-1a hash without allocation. func FNV64a(key string) uint64 { var h uint64 = 14695981039346656037 for i := 0; i < len(key); i++ { @@ -9,6 +10,7 @@ func FNV64a(key string) uint64 { return h } +// FNV64aBytes computes FNV-1a hash from byte slice without allocation. func FNV64aBytes(key []byte) uint64 { var h uint64 = 14695981039346656037 for i := 0; i < len(key); i++ { diff --git a/internal/utils/bytes.go b/internal/utils/bytes.go index 4ca1650..1c09d8a 100644 --- a/internal/utils/bytes.go +++ b/internal/utils/bytes.go @@ -30,6 +30,7 @@ func S2b(s string) []byte { return unsafe.Slice(unsafe.StringData(s), len(s)) } +// BytesContainsFold reports whether b contains subslice, case-insensitively. func BytesContainsFold(b, sub []byte) bool { if len(sub) == 0 { return true