mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-12 04:03:44 +08:00
fix 修复潜在索引越限问题
This commit is contained in:
@@ -75,7 +75,9 @@ func GenHashOption(key interface{}, label string) *model.Option {
|
||||
tag := "default"
|
||||
if _, err := hash.Write(gconv.Bytes(label)); err == nil {
|
||||
index := int(hash.Sum32()) % len(strings)
|
||||
tag = strings[index]
|
||||
if index < len(strings) {
|
||||
tag = strings[index]
|
||||
}
|
||||
}
|
||||
return &model.Option{
|
||||
Key: key,
|
||||
|
||||
Reference in New Issue
Block a user