From 776307e65b5d9bf5547d375e45b32e63330dd19f Mon Sep 17 00:00:00 2001 From: ss <> Date: Fri, 12 Sep 2025 00:17:08 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D=20=E6=9C=AC=E5=9C=B0=2064?= =?UTF-8?q?=20=E4=BD=8D=20int=20=E2=86=92=20=E5=AE=89=E5=85=A8=EF=BC=9B?= =?UTF-8?q?=E7=BA=BF=E4=B8=8A=2032=20=E4=BD=8D=20int=20=E2=86=92=20?= =?UTF-8?q?=E6=BA=A2=E5=87=BA=20=E2=86=92=20panic=20exception=20recovered:?= =?UTF-8?q?=20runtime=20error:=20index=20out=20of=20range=20[-2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/internal/library/dict/dict_option.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/internal/library/dict/dict_option.go b/server/internal/library/dict/dict_option.go index 6fde47d..a628e26 100644 --- a/server/internal/library/dict/dict_option.go +++ b/server/internal/library/dict/dict_option.go @@ -6,9 +6,10 @@ package dict import ( - "github.com/gogf/gf/v2/util/gconv" "hash/fnv" "hotgo/internal/model" + + "github.com/gogf/gf/v2/util/gconv" ) // GenDefaultOption 生成默认表格回显样式 @@ -122,8 +123,8 @@ func GenHashOption(key interface{}, label string, extra ...any) *model.Option { tag := "default" if _, err := hash.Write(gconv.Bytes(label)); err == nil { - index := int(hash.Sum32()) % len(strings) - if index < len(strings) { + index := uint32(hash.Sum32()) % uint32(len(strings)) + if index < uint32(len(strings)) { tag = strings[index] } }